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!
gheegh has quit [Remote host closed the connection]
* phaul is thinking maybe when there is an error we should just let it die and spill the error on stderr instead of the extra work to move it over to stdout. And we should report back stderr.
s3nd1v0g1us has joined #ruby
clemens3 has joined #ruby
s3nd1v0g1us has quit [Client Quit]
clemens3_ has quit [Ping timeout: 268 seconds]
<c-c> phaul so you type command but it won't show errors in the console?
<phaul> nah Im pondering about the bot
<phaul> &>> 1 +
<rubydoc> # => (https://carc.in/#/r/6d0t)
<phaul> it could report back syntax error correctly with carc.in I think
mangold has joined #ruby
xco has joined #ruby
doomspork has joined #ruby
doomspork has quit [Ping timeout: 255 seconds]
orbyt_ has quit [Quit: Textual IRC Client: www.textualapp.com]
rubydoc has quit [Remote host closed the connection]
rubydoc has joined #ruby
<phaul> &>> 1 +
<rubydoc> stderr: -e:3: syntax error, unexpected rescue (https://carc.in/#/r/6d14)
<phaul> there we go :)
rubydoc has quit [Remote host closed the connection]
rubydoc has joined #ruby
<phaul> &>> 1 +
<rubydoc> stderr: -e:3: syntax error, unexpected end (https://carc.in/#/r/6d15)
<phaul> hm. not perfect but it will do
Sembei has quit [Excess Flood]
Sembei has joined #ruby
Dbugger has quit [Quit: Leaving]
bruul has joined #ruby
heino has joined #ruby
heino has left #ruby [#ruby]
code_zombie has joined #ruby
xco has quit [Quit: xco]
_whitelogger has joined #ruby
laaron has quit [Remote host closed the connection]
Nicmavr has quit [Read error: Connection reset by peer]
Nicmavr has joined #ruby
AJA4350 has quit [Remote host closed the connection]
eblip has joined #ruby
def_jam has quit [Ping timeout: 245 seconds]
renich has joined #ruby
sleetdrop has joined #ruby
donofrio_ has joined #ruby
catbusters has quit [Quit: Connection closed for inactivity]
cthulchu_ has quit [Ping timeout: 245 seconds]
wilbert has joined #ruby
sleetdrop has quit [Quit: Computer has gone to sleep.]
sleetdrop has joined #ruby
bruul has quit [Ping timeout: 268 seconds]
wolfshappen_ has quit [Ping timeout: 245 seconds]
wolfshappen has joined #ruby
braincrash has quit [Quit: bye bye]
braincrash has joined #ruby
sleetdrop has quit [Quit: Textual IRC Client: www.textualapp.com]
donofrio has quit [Remote host closed the connection]
t0xik has quit [Quit: Connection closed for inactivity]
v01d4lph4 has joined #ruby
rippa has joined #ruby
dan64 has quit [Ping timeout: 245 seconds]
duckpuppy has quit [Ping timeout: 245 seconds]
duckpuppy has joined #ruby
xlued has quit [Quit: The Lounge - https://thelounge.github.io]
xlued has joined #ruby
donofrio_ has quit [Remote host closed the connection]
wilbert has quit [Quit: wilbert]
mangold has quit [Ping timeout: 252 seconds]
mangold has joined #ruby
_whitelogger has joined #ruby
laaron has joined #ruby
conta has joined #ruby
volkov has joined #ruby
reber has joined #ruby
cd has quit [Quit: cd]
tdy1 has joined #ruby
volkov has quit [Quit: volkov]
aupadhye has joined #ruby
tdy has quit [Ping timeout: 250 seconds]
aufi has joined #ruby
barg has joined #ruby
<barg> are there three different 'byebug's that people use?
GodFather has quit [Ping timeout: 268 seconds]
clemens3 has quit [Ping timeout: 246 seconds]
armyriad has quit [Ping timeout: 244 seconds]
armyriad has joined #ruby
rprimus has joined #ruby
<barg> the thing that david rodriguez wrote, is that pry-byebug, or byebug?
nakuku has joined #ruby
clemens3 has joined #ruby
<al2o3-cr> barg: byebug
<al2o3-cr> pry-byebug uses byebug.
clemens3 has quit [Ping timeout: 246 seconds]
renich has quit [Ping timeout: 245 seconds]
mangold has quit [Ping timeout: 258 seconds]
armyriad has quit [Ping timeout: 245 seconds]
armyriad has joined #ruby
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #ruby
tdy2 has joined #ruby
tdy1 has quit [Ping timeout: 246 seconds]
ntt has joined #ruby
<ntt> Hi, I'd like to extract all values from an Hash with a predefined key. The hash is composed by other hash. Example: h = { :node1 => { :ip => 1.2.3.4, ....}, :node2 => { :ip = 2.3.4.5,...}, ...} , how can I extral all "ip" values in an Array?
<baweaver> What have you tried?
<ntt> flatten
<ntt> but it seems I need to know the "level"
<baweaver> Do you know how map works?
clemens3 has joined #ruby
<ntt> nope... But i'm going to read the doc. is this the right way to do whis?
<baweaver> &>> [1, 2, 3].map { |v| v * 2 } # Map makes a new list by transforming elements using a function, in this case doubling each number
<rubydoc> # => [2, 4, 6] (https://carc.in/#/r/6d34)
<baweaver> &>> {a: 1, b: 2, c: 3}.map { |k, v| v * 2 } # With a hash it gives you the key and the value
<rubydoc> # => [2, 4, 6] (https://carc.in/#/r/6d35)
<ntt> ok. thank you
<baweaver> So in your case, it'd be something like: values.map { |name, info| ... }
<baweaver> See if you can figure it out from there
<baweaver> This is one of the most powerful tools you'll use in Ruby - https://ruby-doc.org/core-2.6.1/Enumerable.html
<baweaver> Enumerable is in Array and Hash as a way to do all sorts of things to collections
<baweaver> The main ones you'll use are: map, select, find, reduce
<baweaver> If you want a fun way to learn all of that: https://www.youtube.com/watch?v=x3b9KlzjJNM
<baweaver> ntt ^
teclator has joined #ruby
doitliao has joined #ruby
<doitliao> any body online?
laaron has quit [Remote host closed the connection]
<baweaver> Could be
<baweaver> or perhaps we're not
<baweaver> You'll have more luck leading with your question though :)
cgfbee has joined #ruby
nowhere_man has quit [Ping timeout: 258 seconds]
nakuku has quit [Ping timeout: 245 seconds]
<ntt> baweaver: thank you. I'm reading the doc. I do not understand if there is the possibility to traverse a very complex Hash reading the value of only one key (in my case "ipaddress") without using map on each sub-hash
<baweaver> ntt: Do you only want the IP?
<ntt> yes
<ntt> but the Hash is very complex, with multiple Hash inseide
<ntt> iside
<ntt> *
<baweaver> That's not really too complex.
<baweaver> Break it down a bit, you have a hash with nested hashes
<baweaver> the key is the name of the node, and the value is its configuration
<ntt> yes
<ntt> but should I use map on each value?
<baweaver> So when using map, ask the configuration what the IP is
<baweaver> Why?
<baweaver> It's a hash, how do you get a single value from a hash?
<ntt> ok... just a moment... I'll give you a more complex example
djdduty has quit [Ping timeout: 272 seconds]
<ntt> I need to extract only ipaddress values
<baweaver> You should probably lead with that
<baweaver> So you only need ipaddress?
<ntt> yes
<baweaver> Not network?
<ntt> no
<ntt> just one array with all ipaddresses (without the key, only values)
<baweaver> So really you only need the nodes
<baweaver> Can you use other gems?
<ntt> yes
<baweaver> Xf.trace(:ipaddress).get_value(hash)
<baweaver> data.map(&Xf.trace(:ipaddress).get)
<ntt> wow... ok. I'll give a try. Really thank you
<baweaver> Traces basically go down through a hash until it can finally find a key that matches
<baweaver> or key and value, but that's a different thing.
<ntt> sure. I'm reading documentation on your github repo
<ntt> it works :) thank you
<baweaver> The two articles up top explain how it works
teclator has quit [Remote host closed the connection]
<ntt> I think it's a good idea pass only environment[:nodes] instead the complete hash. This can reduce the complexity and cpu cycles
<baweaver> Yeah, trace is slow-ish because of how it works
<baweaver> Though to be fair it won't matter unless you have something like 10k nodes or more
<baweaver> and even then, maybe a quarter second
<ntt> ok... but I'd like to use best-practices in my code if possible
<baweaver> The answer to what's the best way to do something is: it depends
mikecmpbll has joined #ruby
<baweaver> Now if there were a way to potentially know what those paths are you could use dig instead.
<ntt> unfortunately the only information I have is that I have to search in environment[:nodes] (instead of the complete hash)
<ntt> but the number of nodes is small (around 30)
<baweaver> but my advice for sysadmin type tasks: optimize for writing time, not runtime, until it becomes an actual issue.
V1s1ble has joined #ruby
<V1s1ble> I'm trying to figure out how to map through dictionary and only produce one dict with lists of sub values: https://bpaste.net/show/c2fc6656e374
<baweaver> for 30 nodes the time difference is non-existent
<V1s1ble> The tricky part is merging the values/lists...
<baweaver> So merge based on similar keys?
<al2o3-cr> ntt: for that example in plain ruby; h[:nodes].map { |k,v| v.values }.map { |ipaddress:, **| ipaddress }
<baweaver> Hash#merge is nice for that.
<baweaver> reduce / each_with_object is good for that type of problem
<baweaver> grep can take a regex (it uses === for compares)
<baweaver> Then just reduce it into a hash with arrays as the default value
<ntt> al2o3-cr: thank you
tdy2 has quit [Read error: error:1408F119:SSL routines:ssl3_get_record:decryption failed or bad record mac]
<V1s1ble> baweaver, cool thanks.
<al2o3-cr> ntt:np
<al2o3-cr> since weechat upgraded to 2.4 it doesn't leave a space between nick when using tab completion. damn annoying.
queip has quit [Quit: bye, freenode]
queip has joined #ruby
<phaul> al2o3-cr: same here. Also if I do double tab (on nick complete) it started inserting some emoji junk that I don't have fonts for
segy has quit [Ping timeout: 268 seconds]
<al2o3-cr> phaul: hmm, i don't have that problem with double tab, just the space issue :(
<phaul> must be some script then I have installed
segy has joined #ruby
<al2o3-cr> phaul: /set weechat.completion.nick_completer ": "
<phaul> al2o3-cr: works! thanks
<al2o3-cr> np
ellcs has joined #ruby
wolfshappen has quit [Ping timeout: 255 seconds]
wolfshappen_ has joined #ruby
SuperL4g has joined #ruby
SuperLag has quit [Ping timeout: 272 seconds]
Fischmie1 has joined #ruby
<linuus> Does foreman restart processes if they crash?
apparition has joined #ruby
Fischmie1 is now known as Fischmop
rubydoc has quit [Ping timeout: 250 seconds]
rubydoc has joined #ruby
lxsameer has joined #ruby
conta has quit [Ping timeout: 250 seconds]
rubydoc has quit [Ping timeout: 245 seconds]
conta has joined #ruby
phaul has quit [Ping timeout: 244 seconds]
phaul has joined #ruby
rubydoc has joined #ruby
rubydoc has quit [Ping timeout: 246 seconds]
phaul has quit [Ping timeout: 244 seconds]
crankharder has joined #ruby
phaul has joined #ruby
rubydoc has joined #ruby
KeyJoo has joined #ruby
rubydoc has quit [Remote host closed the connection]
phaul has quit [Ping timeout: 250 seconds]
phaul has joined #ruby
rubydoc has joined #ruby
marmotini_ has joined #ruby
cisco has joined #ruby
code_zombie has quit [Quit: Leaving]
reber has quit [Remote host closed the connection]
mikecmpbll has quit [Ping timeout: 246 seconds]
al2o3-cr has quit [Quit: WeeChat 2.4]
mikecmpbll has joined #ruby
queip has quit [Ping timeout: 240 seconds]
al2o3-cr has joined #ruby
queip has joined #ruby
Nicmavr has quit [Read error: Connection reset by peer]
Nicmavr has joined #ruby
nowhere_man has joined #ruby
stooj has quit [Quit: ZNC 1.7.0 - https://znc.in]
stooj has joined #ruby
_whitelogger has joined #ruby
crankharder has quit [Ping timeout: 258 seconds]
houhoulis has joined #ruby
crankharder has joined #ruby
jcalla has quit [Ping timeout: 268 seconds]
paraxial has quit [Ping timeout: 255 seconds]
houhoulis has quit [Remote host closed the connection]
paraxial has joined #ruby
nowhere_man has quit [Ping timeout: 255 seconds]
segy has quit [Ping timeout: 250 seconds]
paraxial7 has joined #ruby
AJA4350 has joined #ruby
xrexeon has joined #ruby
paraxial has quit [Ping timeout: 245 seconds]
xrexeon has quit [Max SendQ exceeded]
segy has joined #ruby
apparition has quit [Quit: Bye]
bijan_ has joined #ruby
Tuor has joined #ruby
segy has quit [Ping timeout: 240 seconds]
doomspork has joined #ruby
bijan_ has quit [Remote host closed the connection]
bijan_ has joined #ruby
doomspork has quit [Ping timeout: 255 seconds]
lucasb has joined #ruby
doomspork has joined #ruby
jcalla has joined #ruby
ryouba has joined #ruby
<ryouba> hi!
Tuor has quit [Quit: Konversation terminated!]
<ryouba> is there an 'automated' way (i.e. in a loop inside the initializer or so) to creat attr_accessors for a clasS?
<phaul> sure. inside the class it's just code. attr_* statements are just method calls. You can put them in a loop
Rapture has joined #ruby
<ryouba> yay! :-D
crankharder has quit [Ping timeout: 246 seconds]
<phaul> &>> class X; %i(a b c).each { |sym| attr_accessor(sym) }; end; x = X.new; x.a = 1; x.b = x.a; x.c = x.a + x.b
<rubydoc> # => 2 (https://carc.in/#/r/6d4p)
crankharder has joined #ruby
<ryouba> phaul: sooo ... everything i'm doing in https://gist.github.com/sixtyfive/38831212415f262ebac2b0136cae16b6 is perfectly fine to do? or is any of it a bad idea?
segy has joined #ruby
<phaul> it's fine. but why store something that holds cells inside Entry instead. Like Array or Hash. Probably Array. and then just index []
<phaul> simpler loop would be ('@' .. 'AL').each do |col_letter| ...
<ryouba> phaul: because the cell values are only my input. i plan on adding some methods inside of the Entry class that do stuff with those cell values and produce the output. not sure about the name 'Entry' yet...
conta has quit [Ping timeout: 255 seconds]
<ryouba> wow, nice! thank you for that loop! i didn't think it'd work like that, too. i still feel like it's advanced magic anyways (that it knows to wrap from Z to AA)
ixti has joined #ruby
marmotini_ has quit [Ping timeout: 245 seconds]
v01d4lph4 has quit [Remote host closed the connection]
v01d4lph4 has joined #ruby
hightower2 has joined #ruby
<hightower2> Hey folks how would I produce a pointer to a function? E.g. I have an instance method myobj.something() and I want to pass 'something' around like I would pass a block
<phaul> myobj.method(:something)
<barg> was pry invented in between the two? so, byebug then pry then pry-byebug?
<hightower2> phaul, fabulous, thanks!
<hightower2> just brilliant
v01d4lph4 has quit [Ping timeout: 250 seconds]
<havenwood> barg: you can just check the repos, but the order of invention should be pry, byebug, pry-byebug. there were other debuggers for earlier versions of Ruby.
sylario has joined #ruby
<barg> where does a repo gvie away the date of creation?
<havenwood> barg: just look at the first commit
<havenwood> they have dates
gnufied has joined #ruby
Xeago_ has joined #ruby
Xeago has quit [Ping timeout: 250 seconds]
Xeago_ is now known as Xeago
bijan_ has quit [Remote host closed the connection]
jobewan has joined #ruby
spacesuitdiver has joined #ruby
polishdub has joined #ruby
bijan_ has joined #ruby
<barg> So pry-byebug precedes byebug, (at least looking at initial commit)
agent_white has quit [Quit: leaving]
<barg> havenwood: what made you think the order was pry, byebug, pry-byebug?
yokel has quit [Read error: Connection reset by peer]
jmcgnh has quit [Read error: Connection reset by peer]
<havenwood> barg: i knew pry preceded the others from memory and presumed the byebug plugin followed the gem, but wasn't sure.
yokel has joined #ruby
<havenwood> barg: any particular reason you're curious?
<barg> i'd like to know why there is a pry-byebug and a byebug, is one meant to be an improvement on the other?
conta has joined #ruby
conta has quit [Client Quit]
conta has joined #ruby
tdy2 has joined #ruby
jmcgnh has joined #ruby
<z64> barg: pry-byebug is tooling that implements byebug https://github.com/deivid-rodriguez/pry-byebug/blob/master/pry-byebug.gemspec#L24
<havenwood> barg: the pry plugin does depend on the byebug gem, fwiw: https://github.com/deivid-rodriguez/pry-byebug/blob/master/pry-byebug.gemspec#L24
<havenwood> z64: oh wow, you beat me to the same line :)
<linuus> Does anyone know if foreman restarts processes if they crash?
<z64> lol:)
conta has quit [Client Quit]
Emmanuel_Chanel has quit [Read error: Connection reset by peer]
<barg> if I want to use pry-byebug, am I meant to do both require 'pry' as well as require 'pry-byebug' or is just require 'pry-byebug' fine?
<barg> I notice that pry-byebug doesn't require that I also require 'byebug'
Emmanuel_Chanel has joined #ruby
tdy2 has quit [Ping timeout: 255 seconds]
Bish has joined #ruby
<Bish> there is nothing in default ruby that makes
<Bish> [{a:3}].map {|x| x[:a] } less cumbersome, right?
<phaul> .values ?
<Bish> phaul: im guessing u know what i want?
<phaul> maybe not :)
<phaul> ah I missed the first pair of []
<havenwood> &>> >> [{a: 3}].map { |a:| a }
<rubydoc> stderr: -e:2: syntax error, unexpected >> (https://carc.in/#/r/6d5g)
<havenwood> #=> [3]
wolfshappen_ has quit [Ping timeout: 250 seconds]
<havenwood> Bish: Assuming there are more keys?
<havenwood> &>> [{a: 3}].flat_map &:values
<rubydoc> # => [3] (https://carc.in/#/r/6d5h)
<Bish> |a:| holy shit that works?
wolfshappen has joined #ruby
<havenwood> &>> [{a: 3}].map { |a:| a }
<rubydoc> # => [3] (https://carc.in/#/r/6d5i)
<havenwood> Bish: Yup!
Fusl has quit [Remote host closed the connection]
Fusl has joined #ruby
conta has joined #ruby
<Bish> what is actually the reason hashes dont have method access to it's contents?
<Bish> as long as they're symbols
<Bish> because of things like {to_h:1}
<Bish> ?
bruul has joined #ruby
conta has quit [Quit: conta]
crankharder has quit [Ping timeout: 245 seconds]
<leftylink> probably. though I guess you can do something like...
<leftylink> &>> require 'ostruct'; h = {a: 5}; OpenStruct.new(**h).a
<rubydoc> # => 5 (https://carc.in/#/r/6d5k)
crankharder has joined #ruby
<leftylink> though you cannot do the same with something like to_s
<leftylink> &>> require 'ostruct'; h = {to_s: 5}; OpenStruct.new(**h).to_s
<rubydoc> # => "#<OpenStruct to_s=5>" (https://carc.in/#/r/6d5l)
<leftylink> so doing that will still cause some surprises
<leftylink> ... and just found out that the ** are not needed in either of those example
<leftylink> wow
<leftylink> learn something every day
doitliao has quit [Ping timeout: 244 seconds]
cisco has quit [Ping timeout: 258 seconds]
conta has joined #ruby
conta has quit [Client Quit]
GodFather has joined #ruby
gix has joined #ruby
sagax has quit [Ping timeout: 245 seconds]
segy has quit [Ping timeout: 272 seconds]
conta has joined #ruby
segy has joined #ruby
ixti has quit [Ping timeout: 255 seconds]
conta has quit [Ping timeout: 246 seconds]
cisco has joined #ruby
ellcs has quit [Ping timeout: 245 seconds]
clemens3 has quit [Ping timeout: 245 seconds]
govg has joined #ruby
aufi has quit [Ping timeout: 255 seconds]
tpanarch1st has joined #ruby
lxsameer has quit [Ping timeout: 246 seconds]
cthulchu has joined #ruby
jcarl43 has joined #ruby
bruul has quit [Ping timeout: 268 seconds]
[Butch] has joined #ruby
eb0t_ has joined #ruby
eblip has quit [Ping timeout: 272 seconds]
cd has joined #ruby
ixti has joined #ruby
szulak_ has joined #ruby
Eiam has joined #ruby
mikecmpbll has quit [Remote host closed the connection]
doitliao has joined #ruby
ravenous_ has joined #ruby
bruul has joined #ruby
ravenou__ has joined #ruby
aupadhye has quit [Ping timeout: 245 seconds]
raveno___ has joined #ruby
sameerynho has joined #ruby
ravenous_ has quit [Ping timeout: 250 seconds]
raveno___ has quit [Client Quit]
bijan_ has quit [Remote host closed the connection]
ravenou__ has quit [Ping timeout: 258 seconds]
ravenous_ has joined #ruby
doitliao has quit [Remote host closed the connection]
sagax has joined #ruby
doitliao has joined #ruby
bijan_ has joined #ruby
cisco has quit [Ping timeout: 258 seconds]
\void has joined #ruby
bijan_ has quit [Ping timeout: 252 seconds]
rubydoc has quit [Remote host closed the connection]
rubydoc has joined #ruby
_phaul has joined #ruby
bijan_ has joined #ruby
conta has joined #ruby
<Net> Should env vars be changable at runtime?
phaul has quit [Ping timeout: 268 seconds]
<Net> that is, should setting constants to env vars at the top of module/class definitions be avoided?
v01d4lph4 has joined #ruby
conta has quit [Ping timeout: 255 seconds]
ravenous_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bijan_ has quit [Ping timeout: 258 seconds]
<_phaul> env vars don't seem to reflect changes from the parent process anyways. that's not a ruby thing
<_phaul> export AA=1; ruby -e 'sleep 3; p ENV["AA"]' &; AA=2
<_phaul> # => 1
<Net> _phaul: but env vars can be set within the process
<_phaul> yeah but it's a local change anyways, it won't be reflected outside
<Net> so it seems advantageous to me to be able to change env vars at runtime and see their effect without re-interpreting modules & classes
<Net> I'm looking at class Foo; BAR = ENV['BAR'] and wondering if it's a bad idea
bijan_ has joined #ruby
<_phaul> child processes would inherit the changed environment though. So it's legit to change env vars
_phaul is now known as phaul
bijan_ has quit [Ping timeout: 258 seconds]
cisco has joined #ruby
doitliao has quit [Ping timeout: 255 seconds]
szulak_ has quit [Quit: Textual IRC Client: www.textualapp.com]
SeepingN has joined #ruby
agent_white has joined #ruby
lucasb has quit [Quit: Connection closed for inactivity]
doomspork has quit [Quit: Lost terminal]
bijan_ has joined #ruby
KeyJoo has quit [Ping timeout: 255 seconds]
bijan_ has quit [Read error: Connection reset by peer]
tpanarch1st has quit [Ping timeout: 240 seconds]
bijan_ has joined #ruby
bijan_ has quit [Client Quit]
ravenous_ has joined #ruby
ixti has quit [Ping timeout: 244 seconds]
<sagax> hi all!
<havenwood> sagax: hi!
<sagax> how to make real thread in ruby? not green thread
<havenwood> sagax: Ruby threads are system threads in Ruby 1.9+.
renich has joined #ruby
<havenwood> sagax: With the caveat that in CRuby, there's a global VM lock (GVL, previous GIL).
renich has quit [Remote host closed the connection]
<sagax> oh, yes
<sagax> how to make thread in ruby without GIL?
renich has joined #ruby
<sagax> or ruby 1.9+ can this?
nowhere_man has joined #ruby
lytol_ has joined #ruby
<Net> What's the point of multi threading ruby if the GIL blocks parallel execution?
<havenwood> sagax: Here's a three-part article that goes into some detail about the GVL: https://www.jstorimer.com/blogs/workingwithcode/8085491-nobody-understands-the-gil
<havenwood> sagax: JRuby or TruffleRuby do not have a GVL. With CRuby it'll sometimes block parallel execution, but not always.
<havenwood> Net: Things like IO release the GVL, which is really handy for doing the slowest things in parallel.
hiroaki_ has joined #ruby
cisco has quit [Quit: x]
<Net> havenwood: I see
<leftylink> hmm, I wonder if using backticks in &>> would be unwise
<leftylink> &>> `echo hi`
<rubydoc> # => "hi\n" (https://carc.in/#/r/6d6u)
<havenwood> sagax: You *can* release the GVL manually with Fiddle in CRuby: https://gist.github.com/tenderlove/5733632
<leftylink> amazing
tdy2 has joined #ruby
<leftylink> huh, turns out backticks weren't necessary for the point I needed to make
<havenwood> sagax: Typically, nobody does. Though it's not uncommon to do so in C extensions.
<sagax> thanks to all
colegatron has joined #ruby
jmcgnh has quit [Ping timeout: 245 seconds]
wilbert has joined #ruby
gnufied has quit [Ping timeout: 245 seconds]
tdy2 has quit [Ping timeout: 244 seconds]
lucasb has joined #ruby
gnufied has joined #ruby
conta has joined #ruby
renich_ has joined #ruby
renich has quit [Ping timeout: 240 seconds]
hightower2 has quit [Ping timeout: 255 seconds]
conta has quit [Client Quit]
ivanskie has joined #ruby
<phaul> leftylink: it's carc.in. that takes any risks. For the bot it's strings.
<phaul> I _think_ carc.in puts you in a fresh docker image per request but I'm not sure.
<phaul> &>> `ls -a`
<rubydoc> # => ".\n..\n" (https://carc.in/#/r/6d7a)
<leftylink> I wanted to demonstrate waiting on IO (and therefore still benefitting from threads in the presence of the GVL) with `sleep 5` but it turns out Kernel.sleep also qualifies
<phaul> ah. ok. I misunderstood you point nm
ravenous_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jmcgnh has joined #ruby
TomyLobo has joined #ruby
sriehl has quit [Quit: ZNC 1.7.2 - https://znc.in]
sriehl has joined #ruby
barg has quit []
cnsvc has joined #ruby
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
<Net> any suggestions for namespacing files to avoid conflicts with gems?
colegatron has quit [Quit: Leaving]
ivanskie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
doitliao has joined #ruby
hiroaki_ has quit [Ping timeout: 258 seconds]
alem0lars has joined #ruby
ravenous_ has joined #ruby
dviola has joined #ruby
ravenous_ has quit [Client Quit]
ivanskie has joined #ruby
v01d4lph4 has quit [Read error: Connection reset by peer]
<jmosco> when doing a unit test, I keep getting a character not in range error, but I do not get that error when running the same test outside ruby
<ruby[bot]> jmosco: we in #ruby do not like pastebin.com, it loads slowly for most, has ads which are distracting and has terrible formatting. Please use https://gist.github.com
alem0lars has quit [Ping timeout: 246 seconds]
<mozzarella> what do you mean outside ruby?
<jmosco> just running the `zsh -c` will do what I expect and return 0
<jmosco> same test but wrapped in the testing framework fails
doitliao has quit [Ping timeout: 246 seconds]
jobewan has quit [Ping timeout: 240 seconds]
<al2o3-cr> jmosco: chmod +x /usr/local/opt/kube-ps1/share/kube-ps1.sh and try again.
jobewan has joined #ruby
hahuang65_ has quit [Quit: ZNC - https://znc.in]
ged has quit [Read error: Connection reset by peer]
ged_ has joined #ruby
<leftylink> jmosco: note that when I do `zsh -c "echo $'\u2388 '"` I get a snowflake-like symbol, whereas if I do `env LC_CTYPE=C zsh -c 'echo $"\u2388"'` , I get "zsh:1: character not in range". You may wish to check whether that environment variable (or any of the related environment variables) are set as you expect them to be
<leftylink> where "the related environment variables" are I assume the ones output by `locale` command
bruul has quit [Ping timeout: 272 seconds]
bruul has joined #ruby
Fernando-Basso has joined #ruby
ged_ is now known as ged
mahlon has quit [Ping timeout: 272 seconds]
<lunarkitty> I'm curious, are there any new gui gems that have potential?
tdy2 has joined #ruby
spacesuitdiver has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
v01d4lph4 has joined #ruby
mahlon has joined #ruby
v01d4lph4 has quit [Ping timeout: 245 seconds]
conta has joined #ruby
spacesuitdiver has joined #ruby
hahuang65 has joined #ruby
<jmosco> hmm
<jmosco> al2o3-cr: same error
gnufied has quit [Remote host closed the connection]
jaddison has joined #ruby
spacesuitdiver has quit [Client Quit]
conta has quit [Ping timeout: 245 seconds]
wilbert has quit [Ping timeout: 255 seconds]
wolfshappen has quit [Ping timeout: 245 seconds]
wolfshappen has joined #ruby
Swyper has joined #ruby
s3nd1v0g1us has joined #ruby
SeepingN has quit [Disconnected by services]
SeepingN_ has joined #ruby
aef has quit [Ping timeout: 244 seconds]
spacesuitdiver has joined #ruby
Swyper has quit [Ping timeout: 245 seconds]
Fischmop has quit [Ping timeout: 244 seconds]
govg has quit [Ping timeout: 272 seconds]
govg has joined #ruby
aef has joined #ruby
spacesuitdiver has quit [Client Quit]
renich has joined #ruby
renich_ has quit [Ping timeout: 255 seconds]
Fischmop has joined #ruby
spacesuitdiver has joined #ruby
bruul has quit [Ping timeout: 272 seconds]
dviola has quit [Quit: WeeChat 2.4]
donofrio has joined #ruby
tdy2 has quit [Ping timeout: 255 seconds]
wilbert has joined #ruby
mahlon has quit [Ping timeout: 252 seconds]
ged has quit [Ping timeout: 268 seconds]
mahlon has joined #ruby
Rapture has quit [Quit: Textual IRC Client: www.textualapp.com]
ged has joined #ruby
Swyper has joined #ruby
ellcs has joined #ruby
renich has quit [Quit: renich]
Swyper has quit [Ping timeout: 272 seconds]
moei has quit [Quit: Leaving...]
doitliao has joined #ruby
TomyLobo has quit [Read error: Connection reset by peer]
polishdub has quit [Quit: leaving]
naeemarsalan has joined #ruby
<naeemarsalan> hey guys, quick question, cannot seem to find the answer.... its driving me insane
<naeemarsalan> So an rest api returns value of an array like this <Oxidized::Node::Stats:0x00000001dcc228>
<naeemarsalan> what is this var type and and someone point to the correct doc or wiki :D
noboruma has quit [Ping timeout: 250 seconds]
Nicmavr has quit [Read error: Connection reset by peer]
ramfjord has joined #ruby
ivanskie has quit [Read error: Connection reset by peer]
mozzarella has quit [Read error: Connection reset by peer]
mozzarella has joined #ruby
noboruma has joined #ruby
Nicmavr has joined #ruby
s3nd1v0g1us has quit [Ping timeout: 250 seconds]
lucasb has quit [Quit: Connection closed for inactivity]
<phaul> naeemarsalan: have you tried googling it?
<naeemarsalan> @phaul, yes i tried hash array, class array but nothing quite like this
<naeemarsalan> https://www.rubydoc.info/gems/oxidized/Oxidized/Node/Stats Returns: (Hash, Array) — Hash of stats for every status or Array of stats for specific status
<naeemarsalan> But how can i work with that value, if i set it to a var or even as an array ruby throws an error
<phaul> paste your code you tried and the error you are getting
<ruby[bot]> naeemarsalan: we in #ruby do not like pastebin.com, it loads slowly for most, has ads which are distracting and has terrible formatting. Please use https://gist.github.com
<phaul> ignore that for now I'll look at pastebin
<phaul> ah. I get what's happening
<naeemarsalan> thanks its a very silly attempt but im kinda of ideas...
<naeemarsalan> just nudge me in the right direction :P
<phaul> so. when the API returns an object that doesn't define a nice inspect method ruby default's it to the string with the class name and memory/address/object_id thingy
<phaul> let me demonstrate:
<phaul> &>> class X; end; p X.new
<rubydoc> # => #<X:0x000055e59ec84ce8> (https://carc.in/#/r/6d8z)
<phaul> That's just the default string it gives for x.inspect. It's not the object x. It's just a string.
<phaul> if I did:
<naeemarsalan> ah okay
<phaul> &>> class X; def inspect 'hello!!'; end; end ; p X.new
<rubydoc> stderr: -e:2: syntax error, unexpected tSTRING_BEG, expecting ';' or '\n' (https://carc.in/#/r/6d90)
<phaul> hm.
<havenwood> &>> class X; def inspect; 'hello!!' end end; p X.new
<rubydoc> # => hello!! (https://carc.in/#/r/6d91)
<phaul> thanks havenwood
<havenwood> "#<#{self.class}:#{sprintf "%#018x", object_id << 1}>"
<havenwood> &>> class X; def inspect; "#<#{self.class}:#{sprintf "%#018x", object_id << 1}>" end end; X.new
<rubydoc> # => #<X:0x000055feefb9fb10> (https://carc.in/#/r/6d92)
<havenwood> &>> class X; end; X.new
<rubydoc> # => #<X:0x0000556ac514b970> (https://carc.in/#/r/6d93)
<naeemarsalan> right okay, would i have to define inspect in the api and then i will be able to get the values as normal json most likely?
jaddison has quit [Quit: jaddison]
<phaul> no. Have you tried calling get on it?
tdy2 has joined #ruby
doitliao has quit [Ping timeout: 244 seconds]
<naeemarsalan> how would i do that?
<naeemarsalan> how would i even set that as a class?
ellcs has quit [Ping timeout: 264 seconds]
<phaul> something returned the object that when printed looked like <Oxidized::Node::Stats:0x00000001dcc228>. That object can receive a get (according to the docs). Then it will return a hash.
<naeemarsalan> oh one sec
fluxAeon has quit [Ping timeout: 246 seconds]
Swyper has joined #ruby
naeemarsalan has quit [Ping timeout: 256 seconds]
Swyper has quit [Ping timeout: 244 seconds]
naeemarsalan has joined #ruby
<naeemarsalan> Well i tried a few combination and nothing, so its http://url/nodes/stats.json returns an array like { "NodeName" : "#<Oxidized::Node::Stats:0x00000001dcc228>", ....}
fluxAeon has joined #ruby
<Radar> naeemarsalan: Can we see some code that will cause this same issue to happen on our machines?
<naeemarsalan> well the project is located here, I'm just making spa https://github.com/ytti/oxidized-web
blackmesa has joined #ruby
<Radar> spa? Like with the water, jets and the bubbles?
<naeemarsalan> single page application :)
<naeemarsalan> that would simpler aha
<Radar> ?mcve naeemarsalan
<ruby[bot]> naeemarsalan: Please provide a Minimal, Complete, and Verifiable example: https://stackoverflow.com/help/mcve
<naeemarsalan> let me a spin up docker container with latest version, pretty application is fine
<naeemarsalan> sure*
sameerynho has quit [Ping timeout: 255 seconds]
spectra has quit [Ping timeout: 258 seconds]
Sembei has quit [Read error: Connection reset by peer]
armyriad has quit [Read error: Connection reset by peer]
armyriad has joined #ruby
MyMind has joined #ruby
Fernando-Basso has quit [Remote host closed the connection]
<naeemarsalan> ill pick this up tmrw, thanks anyways guys
naeemarsalan has quit [Quit: Page closed]
<Radar> 👋🏻
spectra has joined #ruby
cnsvc_ has joined #ruby
t0xik has joined #ruby
cnsvc has quit [Ping timeout: 256 seconds]