<up|ime>
a money lib for monetary operations might still be preferred
moei has joined #ruby
<mcspud>
up|ime - naa its just a simple test where I have to import some json files and calculate some simple prices
<mcspud>
This is my main line - @payments.reduce(0) { |acc, payment| acc + payment.amount}, can I use something to cast those values to rationals as I go?
<mcspud>
Maybe even setting the initial reduction to 0r?
<al2o3-cr>
mcspud: sure.
<al2o3-cr>
oh, wait. no.
<al2o3-cr>
you'd have to make sure what your summing is rational
<mcspud>
So from the docs I can wrap it in the Kernal#Rational class, but the tests are looking for floats and ints (ie like 5.5) and not something like (11/2)
<al2o3-cr>
mcspud: i see what it is, how to fix without converting all json value to rational.
<mcspud>
Ahh, what is it?
<mcspud>
This package has good reviews: https://github.com/ruby/bigdecimal - I was going to wrap any of the calculations with it and pray for the best :)
<al2o3-cr>
because the values are assigned to variables
<al2o3-cr>
you'll have to same problem with bigdecimal too.
ellcs has joined #ruby
<al2o3-cr>
mcspud: just round(2)
<mcspud>
So (val1 + val2).round(2) ?
<al2o3-cr>
mcspud: yes.
<mcspud>
awesome give me a miunte
<mcspud>
minute*
<al2o3-cr>
not the best solution, but...
<icy`>
puts "%.2f" % (3.50 + 3.03)
<icy`>
you just want it to appear rounded right? sprintf style ^
<mcspud>
Finished in 0.01419 seconds (files took 0.10393 seconds to load)
<mcspud>
5 examples, 0 failures
<mcspud>
Awesome thanks so much
ua_ has joined #ruby
<mcspud>
One more question, is MyClass.call a special signature?
ua has quit [Read error: Connection reset by peer]
<mcspud>
I had to modify their test suite to use MyClass.new instead of call
<al2o3-cr>
no, call is just a method on the class MyClass
ua_ is now known as ua
Zarthus has quit [Quit: Gone.]
<mcspud>
Ok thanks
<al2o3-cr>
np mcspud ;)
Zarthus has joined #ruby
Zarthus has quit [Remote host closed the connection]
szulak_ has joined #ruby
Zarthus has joined #ruby
Zarthus has quit [Remote host closed the connection]
Zarthus has joined #ruby
Zarthus has quit [Remote host closed the connection]
reber has joined #ruby
szulak_ has quit [Client Quit]
renich has quit [Quit: renich]
Zarthus has joined #ruby
<al2o3-cr>
up|ime: are you Zarthus too?
renich has joined #ruby
<Zarthus>
al2o3-cr: Yeah, though this should be the final disconnect
<al2o3-cr>
ah, no probs, just from the irb paste ;)
kapil____ has quit [Quit: Connection closed for inactivity]
<up|ime>
the bot was having problems and I couldn't bother finding out what the syntax would be :P
<up|ime>
so I just booted up ssh+irb
<al2o3-cr>
hehe :)
Zarthus has quit [Quit: Gone.]
Zarthus has joined #ruby
lxsameer has joined #ruby
renich has quit [Ping timeout: 272 seconds]
roshanavand has joined #ruby
Zarthus has quit [Remote host closed the connection]
Zarthus has joined #ruby
<Zarthus>
ping @ops: all urls in the ENTRYMSG of this channel support https from the looks of it
Zarthus has quit [Quit: Gone.]
Zarthus has joined #ruby
sezuan has quit [Ping timeout: 264 seconds]
sezuan has joined #ruby
d^sh has quit [Ping timeout: 245 seconds]
d^sh has joined #ruby
Zarthus has quit [Quit: Gone.]
Zarthus has joined #ruby
lucasb has joined #ruby
conta has joined #ruby
conta has quit [Ping timeout: 240 seconds]
mikecmpbll has joined #ruby
roshanavand has quit [Ping timeout: 250 seconds]
AJA4350 has joined #ruby
ravenousmoose has joined #ruby
blackmesa has joined #ruby
themsay has joined #ruby
roshanavand has joined #ruby
ravenousmoose has quit [Quit: Taking a quick nap...ZZzzz]
xrexeon has joined #ruby
xrexeon has quit [Max SendQ exceeded]
marz_d`ghostman has joined #ruby
<marz_d`ghostman>
I'm running my ruby script via cron: scl enable rh-ruby24 /usr/bin/local/ruby_script. Is there a shortcut where it would read and use the ruby version and gemset of that script?
<marz_d`ghostman>
Currently I'm getting an error running it unless I run it when i'm on the directory itself
themsay has quit [Ping timeout: 240 seconds]
universa1 has quit [Quit: ZNC 1.6.1+deb1~ubuntu14.04.0 - http://znc.in]
themsay has joined #ruby
universa1 has joined #ruby
conta has joined #ruby
conta has quit [Ping timeout: 268 seconds]
dellavg__ has joined #ruby
roshanavand has quit [Ping timeout: 268 seconds]
nowhereman has joined #ruby
roshanavand has joined #ruby
<j416>
marz_d`ghostman: are you using bundler?
<marz_d`ghostman>
j416: yep I do
Fernando-Basso has quit [Remote host closed the connection]
<j416>
marz_d`ghostman: 'bundler exec' perhaps?
conta has joined #ruby
<marz_d`ghostman>
j416: it install in the directory itself, when the command to run the script is run via cron, it doesn't seem to use the gemset installed by bundler
roshanavand has quit [Remote host closed the connection]
akem__ has joined #ruby
roshanavand has joined #ruby
roshanavand has quit [Remote host closed the connection]
roshanavand has joined #ruby
conta has quit [Ping timeout: 245 seconds]
akem has quit [Ping timeout: 246 seconds]
roshanavand has quit [Remote host closed the connection]
<j416>
marz_d`ghostman: did you try 'bundler exec'?
roshanavand has joined #ruby
roshanavand has quit [Remote host closed the connection]
<marz_d`ghostman>
j416: Ah I just got that, let me try
hrrz has joined #ruby
<hrrz>
hi - i'm struggling installing ruby on centos without gcc. any idea? I use the following ./configure -prefix=/home/wf/env --without-gcc - and getting checking whether the C compiler works... no
dviola has joined #ruby
<hrrz>
anyone knows?
alfiemax has joined #ruby
<hrrz>
hi - i'm struggling installing ruby on centos without gcc. any idea? I use the following ./configure -prefix=/home/wf/env --without-gcc - and getting checking whether the C compiler works... no
alfiemax has quit [Remote host closed the connection]
<darix>
hrrz: you need a C compiler to build ruby. there is no way around it.
<hrrz>
darix: i tried now a different approach, running configure on a host with gcc and then moving the Makefile and dir to a host with only clang - i saw an a python example that it works. but still failing with
<hrrz>
this: /usr/bin/ld: cannot find crtbeginS.o: No such file or directory
<darix>
uhhm
<darix>
hrrz: export CC=clang CXX=clang++
<darix>
run configure
<hrrz>
on the gcc host?
<darix>
no
<darix>
on the machine where you want to build it
<hrrz>
darix: still getting: checking whether the C compiler works... no
ravenousmoose has quit [Quit: Taking a quick nap...ZZzzz]
cthu| has joined #ruby
cthulchu_ has quit [Ping timeout: 240 seconds]
<Iambchop>
hrrz: this is from debian not centosm but: "clang-3.4 can't compile programs in a minimal chroot...install libgcc-4.7-dev or libgcc-4.8-dev, the problem goes away" https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=754963
cthulchu_ has joined #ruby
cthu| has quit [Ping timeout: 240 seconds]
kapil____ has joined #ruby
lucasb has quit [Quit: Connection closed for inactivity]
hrrz has quit [Ping timeout: 256 seconds]
Fernando-Basso has joined #ruby
cd has joined #ruby
rkazak has joined #ruby
reber has quit [Remote host closed the connection]
alfiemax_ has joined #ruby
jottr has joined #ruby
rkazak has quit [Quit: Sleep.....ing....]
rkazak has joined #ruby
moonglum[m] has joined #ruby
conta has joined #ruby
nowhereman has quit [Remote host closed the connection]
nowhereman has joined #ruby
conta has quit [Ping timeout: 245 seconds]
<hays>
is there a data structure that is basically a hash where both key and value are keys? bidirectional essentially
<hays>
within ruby that is.. i think its easy enough to make one, using two hashes
<havenwood>
hays: Are the values unique?
<hays>
for each k there exists only one k in the set and same for v
<havenwood>
hays: Then an option with Hash is to #invert before looking up values.
<leftylink>
the ruby console shows you the value of the last expression, which is not necessarily the same as the value assigned to any variables that may have been present
ellcs has quit [Ping timeout: 240 seconds]
Nicmavr has quit [Read error: Connection reset by peer]
Nicmavr has joined #ruby
raulp has quit [Read error: Connection reset by peer]
raulp has joined #ruby
<havenwood>
blackmesa: it's similar to: false if result = true
\void has joined #ruby
<havenwood>
blackmesa: with explicit parens: (result = true) and false