havenwood changed the topic of #ruby to: Rules & more: https://ruby-community.com | Ruby 2.6.1, 2.5.3, 2.4.5: https://www.ruby-lang.org | Paste 4+ lines of text to https://dpaste.de/ and select Ruby as the language | Rails questions? Ask in #RubyOnRails | Books: https://goo.gl/wpGhoQ | Logs: https://irclog.whitequark.org/ruby | Can't talk? Register/identify with Nickserv first!
alfiemax has quit [Ping timeout: 240 seconds]
alfiemax has joined #ruby
alfiemax has quit [Ping timeout: 240 seconds]
AJA4350 has quit [Ping timeout: 250 seconds]
cnsvc has quit [Ping timeout: 256 seconds]
AJA4350 has joined #ruby
_whitelogger has joined #ruby
tdy has quit [Ping timeout: 245 seconds]
mikecmpbll has quit [Quit: inabit. zz.]
cow[moo] has joined #ruby
cow[moo] has quit [Client Quit]
agent_white has joined #ruby
gix has quit [Ping timeout: 268 seconds]
\void has quit [Quit: So long, and thanks for all the fish.]
AJA4350 has quit [Remote host closed the connection]
renich_ has joined #ruby
renich has quit [Ping timeout: 244 seconds]
TomyLobo has joined #ruby
agent_white has quit [Quit: brb]
alfiemax has joined #ruby
alfiemax has quit [Ping timeout: 272 seconds]
alfiemax has joined #ruby
braincrash has quit [Ping timeout: 240 seconds]
tdy has joined #ruby
braincrash has joined #ruby
alfiemax has quit [Ping timeout: 240 seconds]
cnsvc has joined #ruby
TomyLobo has quit [Read error: Connection reset by peer]
znz_jp has quit [Ping timeout: 240 seconds]
znz_jp has joined #ruby
lxsameer has quit [Ping timeout: 240 seconds]
rkazak has joined #ruby
rkazak has quit [Ping timeout: 240 seconds]
tdy has quit [Ping timeout: 250 seconds]
moei has joined #ruby
tdy has joined #ruby
tdy has quit [Ping timeout: 240 seconds]
apparition has joined #ruby
rkazak has joined #ruby
\void has joined #ruby
z4phod has quit [Ping timeout: 250 seconds]
rkazak has quit [Read error: Connection timed out]
braincrash has quit [Ping timeout: 240 seconds]
z4phod has joined #ruby
tdy has joined #ruby
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
rkazak has joined #ruby
laaron has joined #ruby
braincrash has joined #ruby
rkazak has quit [Ping timeout: 246 seconds]
tdy has quit [Ping timeout: 268 seconds]
tdy has joined #ruby
robscomputer has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
alfiemax has joined #ruby
robscomputer has joined #ruby
renich has joined #ruby
renich_ has quit [Ping timeout: 246 seconds]
cnsvc has quit [Ping timeout: 256 seconds]
braincrash has quit [Quit: bye bye]
jcalla has quit [Ping timeout: 246 seconds]
braincrash has joined #ruby
themsay has quit [Ping timeout: 240 seconds]
tdy has quit [Read error: Connection reset by peer]
tdy has joined #ruby
alfiemax has quit [Ping timeout: 245 seconds]
alfiemax has joined #ruby
_whitelogger has joined #ruby
alfiemax has quit [Ping timeout: 240 seconds]
jcalla has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
segy has quit [Quit: ZNC - http://znc.in]
rkazak has joined #ruby
apparition has quit [Quit: Bye]
segy has joined #ruby
dinfuehr has quit [Ping timeout: 250 seconds]
dinfuehr has joined #ruby
dinfuehr has quit [Ping timeout: 250 seconds]
dinfuehr has joined #ruby
alfiemax has joined #ruby
rkazak has quit [Ping timeout: 246 seconds]
rippa has joined #ruby
dinfuehr has quit [Ping timeout: 240 seconds]
alfiemax has quit [Ping timeout: 272 seconds]
dinfuehr has joined #ruby
rkazak has joined #ruby
donofrio has quit [Remote host closed the connection]
code_zombie has quit [Quit: Leaving]
Xiti has joined #ruby
moei has quit [Ping timeout: 268 seconds]
cnsvc has joined #ruby
Sherlime is now known as uplime
rkazak has quit [Read error: Connection timed out]
rkazak has joined #ruby
tdy has quit [Remote host closed the connection]
robscomputer has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
\void has quit [Quit: So long, and thanks for all the fish.]
d10n-work has quit [Quit: Connection closed for inactivity]
\void has joined #ruby
armyriad has quit [Quit: Leaving]
dinfuehr has quit [Ping timeout: 245 seconds]
d^sh has quit [Ping timeout: 240 seconds]
d^sh has joined #ruby
armyriad has joined #ruby
dinfuehr has joined #ruby
armyriad has quit [Max SendQ exceeded]
sauvin has joined #ruby
cd has quit [Quit: cd]
dinfuehr has quit [Ping timeout: 246 seconds]
dinfuehr has joined #ruby
dinfuehr has quit [Ping timeout: 250 seconds]
dinfuehr has joined #ruby
JanMrlth has joined #ruby
orbyt_ has joined #ruby
nfk has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rkazak has quit [Ping timeout: 245 seconds]
kapil____ has joined #ruby
n13z_ has quit [Ping timeout: 268 seconds]
n13z has joined #ruby
ravenousmoose has joined #ruby
alfiemax has joined #ruby
SeepingN has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
alfiemax has quit [Remote host closed the connection]
arekushi has quit [Ping timeout: 252 seconds]
_whitelogger has joined #ruby
nowhereman has quit [Ping timeout: 252 seconds]
blackmesa1 has joined #ruby
jcarl43 has quit [Read error: Connection reset by peer]
blackmesa1 has quit [Ping timeout: 250 seconds]
blackmesa1 has joined #ruby
\void has quit [Quit: So long, and thanks for all the fish.]
ravenousmoose has quit [Quit: Taking a quick nap...ZZzzz]
ravenousmoose has joined #ruby
n13z has quit [Ping timeout: 268 seconds]
n13z has joined #ruby
ravenousmoose has quit [Quit: Taking a quick nap...ZZzzz]
nfk has quit [Quit: Try memory.free_dirty_pages=true in about:config]
cnsvc has quit [Quit: WeeChat 2.3]
rkazak has joined #ruby
rkazak has quit [Ping timeout: 268 seconds]
gix has joined #ruby
mcspud has joined #ruby
<mcspud> Hi all, new to ruby but very experienced developer. Does anyone know why i'm getting rounding errors? https://dpaste.de/0LW4
Fernando-Basso has joined #ruby
Nicmavr has quit [Read error: Connection reset by peer]
<up|ime> mcspud: sounds like floating point maths to me
<up|ime> without linking code, our best guess is exactly that ^
<mcspud> Yeah, but even at 2pts of precision? 1.15 + 3.35
<mcspud> Yep one moment
Nicmavr has joined #ruby
<up|ime> [zarthus@nomenclature ~] $ irb
<up|ime> => 6.529999999999999
<up|ime> irb(main):001:0> 3.50 + 3.03
<up|ime> yep.
<mcspud> ^_^
<al2o3-cr> mcspud: use Rationals
<mcspud> Any arbitrary precision think you can recommend
<mcspud> s/think/thing
<up|ime> if you're dealing with money, use a money lib
<mcspud> al2o3-cr - Sorry I literally started using ruby 2 hours ago - I've written my solution, I just can't get this test topass :)
<mcspud> Is rationals in the stdlib?
<al2o3-cr> &>> 3.50r + 3.03r == 6.53
<rubydoc> # => true (https://carc.in/#/r/65b9)
<al2o3-cr> &ri Rational mcspud
<mcspud> great thanks
<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)
<mcspud> Any ideas?
<al2o3-cr> &>> 3.50r + 3.03r == 6.53
<rubydoc> # => true (https://carc.in/#/r/65bc)
<al2o3-cr> it doesn't matter if it returns (11/2) or whatever.
blackmesa1 has quit [Quit: WeeChat 2.3]
<mcspud> Does if the test doesn't pass :)
<al2o3-cr> it's not passing?
<mcspud> al2o3-cr - https://dpaste.de/t0Xo
conta has joined #ruby
<al2o3-cr> i don't see why that isn't working, try Rational(order_total - payment_total).to_f
<mcspud> al2o3-cr - https://dpaste.de/oNVL comes back with that precision issue
<mcspud> I'm on 2.3.7 if you know of anything that was funky in this release
<al2o3-cr> not that i know of, there's something else wrong with your code.
conta has quit [Ping timeout: 240 seconds]
<al2o3-cr> &>> Rational(8.00 - 2.50).to_f
<rubydoc> # => 5.5 (https://carc.in/#/r/65bh)
<al2o3-cr> maybe show your whole code.
<mcspud> sure, 1 moment
<al2o3-cr> bb in a sec.
<mcspud> al2o3-cr - https://dpaste.de/2jzj
ntt has quit [Ping timeout: 245 seconds]
<al2o3-cr> bk
<al2o3-cr> one sec taking a look.
<mcspud> Cheers dude
Dbugger has joined #ruby
<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> &>> [(3.50r + 3.03r).to_f, Rational(x=3.50 + y=3.03).to_f]
<rubydoc> # => [6.53, 6.529999999999999] (https://carc.in/#/r/65bt)
<mcspud> I see
clemens3 has joined #ruby
<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
<darix> see config.log
ravenousmoose has joined #ruby
rkazak has joined #ruby
rkazak has quit [Ping timeout: 250 seconds]
blackmesa has quit [Quit: WeeChat 2.3]
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.
<hays> invert is O(n) i bet
<havenwood> &>> h = {a: 1, b: 2, c: 3}; h.invert[2]
<rubydoc> # => :b (https://carc.in/#/r/65fl)
<hays> there's rassoc too i think
<havenwood> oops, meant that second one to link a few lines down - rb_hash_foreach
rkazak has quit [Quit: Sleep.....ing....]
orbyt_ has joined #ruby
<hays> a decent option if im creating it once and not really updating it
alfiemax_ has quit [Remote host closed the connection]
arekushi has joined #ruby
<havenwood> hays: Yeah, if you're not mutating the Hash, invert once and have two Hashes - one for each direction.
<havenwood> hays: Are you changing values or adding keys often?
<hays> not in this use case
akem__ has quit [Ping timeout: 240 seconds]
akem has joined #ruby
rkazak has joined #ruby
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 250 seconds]
AJA4351 is now known as AJA4350
ellcs has quit [Ping timeout: 240 seconds]
moonglum[m] is now known as moonglum
rkazak has quit [Quit: Sleep.....ing....]
agent_white has joined #ruby
snowflakekiller has joined #ruby
snowflakekiller has quit [Client Quit]
kapil____ has quit [Quit: Connection closed for inactivity]
conta has joined #ruby
conta has quit [Ping timeout: 246 seconds]
rkazak has joined #ruby
robscomputer has joined #ruby
IGnorAND has joined #ruby
meinside has quit [Quit: Connection closed for inactivity]
AJA4350 has quit [Ping timeout: 272 seconds]
dviola has quit [Quit: WeeChat 2.3]
ellcs has joined #ruby
hahuang6- has quit [Read error: Connection reset by peer]
hahuang6- has joined #ruby
PasNox has quit [Remote host closed the connection]
rkazak has quit [Quit: Sleep.....ing....]
PasNox has joined #ruby
themsay has quit [Ping timeout: 245 seconds]
renich has joined #ruby
uplime has quit [Quit: ZNC 1.7.1 - https://znc.in]
uplime has joined #ruby
Zarthus has quit [Quit: Gone.]
Zarthus has joined #ruby
agent_white has quit [Quit: brb]
blackmesa has joined #ruby
<blackmesa> result = true and false
<blackmesa> results in true
<blackmesa> in my ruby console its false
<leftylink> correction: the result of the expression is false, but `result` is true.
<leftylink> &>> xxx = (result = true and false); [xxx, result]
<rubydoc> # => [false, true] (https://carc.in/#/r/65hc)
<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
<baweaver> New stream just finished - Exploring ASTs - https://www.twitch.tv/videos/374107796
FernandoBasso has joined #ruby
FernandoBasso has quit [Read error: Connection reset by peer]
wilbert has joined #ruby
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
Fernando-Basso has quit [Ping timeout: 272 seconds]
AJA4350 has joined #ruby
crankharder has quit [Remote host closed the connection]
Inline has quit [Read error: Connection reset by peer]
arcaos has joined #ruby
alfiemax has joined #ruby
jlauer has joined #ruby
arcaos has quit [Ping timeout: 244 seconds]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
krawchyk has joined #ruby
alfiemax has quit [Ping timeout: 246 seconds]
Inline has joined #ruby
wilbert has quit [Ping timeout: 246 seconds]
dellavg__ has quit [Ping timeout: 250 seconds]
orbyt_ has joined #ruby
wilbert has joined #ruby
Dreamer3 has joined #ruby
wilbert has quit [Quit: wilbert]
Dbugger has quit [Ping timeout: 240 seconds]
Dreamer3 has quit [Quit: Computer has gone to sleep.]
agent_white has joined #ruby
TomyLobo has joined #ruby
robscomputer has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ruby[bot] has quit [Remote host closed the connection]
duckpupp- has joined #ruby
ruby[bot] has joined #ruby
duckpuppy has quit [Ping timeout: 246 seconds]
tdy has joined #ruby
Swyper has joined #ruby
alfiemax has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Milos has quit [Read error: Connection reset by peer]
AJA4350 has quit [Ping timeout: 250 seconds]
houhoulis has joined #ruby
Milos has joined #ruby
xrexeon has joined #ruby
xrexeon has quit [Max SendQ exceeded]
alfiemax has quit [Ping timeout: 245 seconds]
themsay has joined #ruby
clemens3 has quit [Ping timeout: 245 seconds]
clemens3_ has joined #ruby
Swyper has quit [Remote host closed the connection]