havenwood changed the topic of #ruby to: Rules & more: https://ruby-community.com | Ruby 2.6.5, 2.5.7, 2.7.0-preview1: 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!
drincruz has joined #ruby
bruce_lee has quit [Ping timeout: 265 seconds]
bruce_lee has joined #ruby
TCZ has joined #ruby
wildtrees has quit [Quit: Leaving]
reyfi9e has quit [Quit: Konversation term]
bambanx has quit [Quit: Leaving]
xco has joined #ruby
AJA4351 has joined #ruby
baojg has joined #ruby
AJA4350 has quit [Ping timeout: 240 seconds]
AJA4351 is now known as AJA4350
ElFerna has joined #ruby
Esa_ has quit []
gix- has joined #ruby
gix has quit [Disconnected by services]
ElFerna has left #ruby [#ruby]
dbz_ has quit [Remote host closed the connection]
akemhp_ has joined #ruby
Azure has joined #ruby
dbz_ has joined #ruby
akemhp_ is now known as akemLenovo
dbz__ has joined #ruby
dbz_ has quit [Ping timeout: 265 seconds]
dbz__ has quit [Ping timeout: 240 seconds]
ElFerna has joined #ruby
ElFerna has quit [Client Quit]
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 240 seconds]
AJA4351 is now known as AJA4350
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
d^sh has quit [Ping timeout: 252 seconds]
d^sh has joined #ruby
TCZ has quit [Quit: Bye Bye]
Technodrome has joined #ruby
ramfjord has quit [Ping timeout: 265 seconds]
stryek has quit [Quit: Connection closed for inactivity]
AJA4350 has quit [Quit: AJA4350]
xco_ has joined #ruby
Emmanuel_Chanel has quit [Ping timeout: 268 seconds]
xco has quit [Ping timeout: 240 seconds]
xco_ is now known as xco
jmcgnh has quit [Ping timeout: 265 seconds]
jmcgnh_ has joined #ruby
jmcgnh_ is now known as jmcgnh
jmcgnh is now known as jmcgnh_
jmcgnh_ is now known as jmcgnh
Swyper has quit [Remote host closed the connection]
_dbugger has joined #ruby
dasher00 has quit [Ping timeout: 265 seconds]
ua has quit [Excess Flood]
dbugger has quit [Ping timeout: 245 seconds]
ua has joined #ruby
akemhp_ has joined #ruby
ua has quit [Excess Flood]
ua has joined #ruby
akemhp has quit [Ping timeout: 246 seconds]
<brool> where does the JSON object come from? i can't find it in the ruby docs
banisterfiend has joined #ruby
<adam12> brool: Psych
<adam12> Which is silly but *shrug*
<brool> what is psych
weird_error has quit [Quit: weird_error]
Ai9zO5AP has quit [Ping timeout: 276 seconds]
<adam12> &ri psych
<rubydoc> Found no entry that matches method psych
<adam12> Oh. NM. I'm thinking YAML for some reason.
Swyper has joined #ruby
banisterfiend has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Emmanuel_Chanel has joined #ruby
greypack has quit [Ping timeout: 252 seconds]
Swyper has quit [Ping timeout: 276 seconds]
shtirlic has quit [Quit: ZNC - http://znc.in]
greypack has joined #ruby
greengriminal has joined #ruby
shtirlic has joined #ruby
ua has quit [Ping timeout: 240 seconds]
ua has joined #ruby
lucasb has quit [Quit: Connection closed for inactivity]
ua has quit [Excess Flood]
ua has joined #ruby
dar123 has joined #ruby
akemhp has joined #ruby
mozzarella has quit [Ping timeout: 240 seconds]
jeremycw has joined #ruby
akem__ has joined #ruby
cd has quit [Quit: cd]
akemhp_ has quit [Ping timeout: 240 seconds]
mozzarella has joined #ruby
dbz_ has joined #ruby
akemhp has quit [Ping timeout: 276 seconds]
jeremycw has quit [Ping timeout: 246 seconds]
mozzarella has quit [Remote host closed the connection]
mozzarella has joined #ruby
xco has quit [Quit: xco]
banisterfiend has joined #ruby
dbz_ has quit [Ping timeout: 246 seconds]
duderonomy has joined #ruby
akem__ has quit [Ping timeout: 246 seconds]
akemhp_ has joined #ruby
xco has joined #ruby
shtirlic_ has joined #ruby
akemLenovo has quit [Ping timeout: 268 seconds]
shtirlic has quit [Ping timeout: 276 seconds]
shtirlic_ is now known as shtirlic
gix- has quit [Ping timeout: 240 seconds]
gix has joined #ruby
shtirlic has quit [Ping timeout: 245 seconds]
shtirlic_ has joined #ruby
shtirlic_ is now known as shtirlic
fphilipe has joined #ruby
shtirlic has quit [Quit: ZNC - http://znc.in]
gix has quit [Ping timeout: 240 seconds]
shtirlic has joined #ruby
fphilipe has quit [Ping timeout: 276 seconds]
banisterfiend has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dar123 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
riceandb1ans is now known as riceandbeans
riceandbeans has quit [Changing host]
riceandbeans has joined #ruby
shakes has joined #ruby
chalkmonster has quit [Quit: WeeChat 2.6]
shakes has quit [Remote host closed the connection]
ajunior_ has joined #ruby
DTZUZO has quit [Quit: WeeChat 2.0]
DTZUZO has joined #ruby
greengriminal has quit [Quit: This computer has gone to sleep]
greengriminal has joined #ruby
Swyper has joined #ruby
Swyper has quit [Ping timeout: 268 seconds]
chalkmonster has joined #ruby
Some-body_ has joined #ruby
DarthGandalf has quit [Ping timeout: 268 seconds]
Some-body_ is now known as DarthGandalf
donofrio has quit [Remote host closed the connection]
ua has quit [Ping timeout: 240 seconds]
ua has joined #ruby
ropeney has quit [Quit: ZNC 1.7.4 - https://znc.in]
ropeney has joined #ruby
grilix has quit [Ping timeout: 276 seconds]
akem__ has joined #ruby
akemhp_ has quit [Ping timeout: 240 seconds]
akemhp has joined #ruby
chalkmonster has quit [Quit: WeeChat 2.6]
akem__ has quit [Ping timeout: 268 seconds]
ur5us has joined #ruby
ur5us has quit [Remote host closed the connection]
ur5us has joined #ruby
ajunior_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
chalkmonster has joined #ruby
chalkmonster has quit [Client Quit]
ur5us has quit [Ping timeout: 265 seconds]
Inline has quit [Quit: Leaving]
nurettin has joined #ruby
dionysus69 has joined #ruby
nurettin has quit [Client Quit]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ua has quit [Ping timeout: 245 seconds]
ua has joined #ruby
greengriminal has quit [Quit: This computer has gone to sleep]
fphilipe has joined #ruby
Swyper has joined #ruby
Swyper has quit [Remote host closed the connection]
fphilipe has quit [Ping timeout: 250 seconds]
fphilipe has joined #ruby
ajunior_ has joined #ruby
bruce_lee has quit [Ping timeout: 240 seconds]
bruce_lee has joined #ruby
bruce_lee has quit [Changing host]
bruce_lee has joined #ruby
ajunior_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
quazimodo has joined #ruby
<quazimodo> i don't like the sound of 'mon_is_available:boolean' in my db
<quazimodo> anyone have better words for this sort of predicate ?
<quazimodo> tue_available_p is something i've seen in other languages but it's arguably harder to understand
<quazimodo> dont we have a construct for this scenario in the english language?
chalkmonster has joined #ruby
bruce_lee has quit [Ping timeout: 240 seconds]
bruce_lee has joined #ruby
bruce_lee has joined #ruby
bruce_lee has quit [Changing host]
absolutejam4 has joined #ruby
schne1der has joined #ruby
banisterfiend has joined #ruby
schne1der has quit [Ping timeout: 240 seconds]
chalkmonster has quit [Quit: WeeChat 2.6]
Freshnuts has quit [Quit: Leaving]
andikr has joined #ruby
_mossplix has joined #ruby
brool has quit [Ping timeout: 250 seconds]
absolutejam4 has quit [Ping timeout: 264 seconds]
banisterfiend has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bruce_lee has quit [Ping timeout: 264 seconds]
akemhp_ has joined #ruby
bruce_lee has joined #ruby
jeremycw has joined #ruby
freedom has quit [Ping timeout: 252 seconds]
freedom_ has joined #ruby
jeremycw has quit [Ping timeout: 240 seconds]
freedom_ is now known as freedom
xco has quit [Quit: xco]
fanta1 has joined #ruby
ctp has quit [Ping timeout: 240 seconds]
fphilipe has quit [Ping timeout: 240 seconds]
jmcgnh has quit [Ping timeout: 265 seconds]
akem__ has joined #ruby
akemhp has quit [Ping timeout: 240 seconds]
akem__ has quit [Ping timeout: 264 seconds]
fphilipe has joined #ruby
_mossplix has quit [Remote host closed the connection]
fphilipe has quit [Ping timeout: 264 seconds]
absolutejam4 has joined #ruby
_mossplix has joined #ruby
conta1 has joined #ruby
ravenousmoose has joined #ruby
fphilipe has joined #ruby
freedom has quit [Quit: freedom]
ravenousmoose has quit [Ping timeout: 246 seconds]
al2o3-cr has quit [Quit: WeeChat 2.6]
jmcgnh has joined #ruby
al2o3-cr has joined #ruby
_dbugger is now known as dbugger
ur5us has joined #ruby
Nicmavr has quit [Read error: Connection reset by peer]
Nicmavr has joined #ruby
jmcgnh has quit [Ping timeout: 265 seconds]
jmcgnh has joined #ruby
schne1der has joined #ruby
ajunior_ has joined #ruby
ajunior_ has quit [Client Quit]
lxsameer has joined #ruby
_mossplix has quit [Remote host closed the connection]
paraxial934 has quit [Quit: The Lounge - https://thelounge.chat]
paraxial has joined #ruby
mikecmpbll has joined #ruby
troulouliou_div2 has joined #ruby
Jonopoly has joined #ruby
Intelo has quit [Ping timeout: 240 seconds]
conta1 has quit [Ping timeout: 265 seconds]
_mossplix has joined #ruby
mn3m has joined #ruby
conta1 has joined #ruby
poontangmessiah has joined #ruby
sagax has quit [Remote host closed the connection]
Intelo has joined #ruby
vondruch has quit [Ping timeout: 240 seconds]
jeremycw has joined #ruby
sagax has joined #ruby
_mossplix has quit [Remote host closed the connection]
jeremycw has quit [Ping timeout: 250 seconds]
_mossplix has joined #ruby
ellcs has joined #ruby
ellcs has quit [Remote host closed the connection]
DaniG2k has joined #ruby
ellcs has joined #ruby
poontangmessiah has quit [Ping timeout: 240 seconds]
DTZUZO has quit [Ping timeout: 268 seconds]
Ai9zO5AP has joined #ruby
Fernando-Basso has joined #ruby
akem__ has joined #ruby
akemhp_ has quit [Ping timeout: 245 seconds]
akemhp_ has joined #ruby
Intelo has quit [Ping timeout: 250 seconds]
akem__ has quit [Ping timeout: 240 seconds]
ur5us has quit [Remote host closed the connection]
<Bish> .map { |rg| rg.values.reject { |k,_| k == :id || k == :name } }
<Bish> how would you write that pretty without allocating an array?
absolutejam4 has quit [Ping timeout: 240 seconds]
_mossplix has quit [Remote host closed the connection]
<phaul> is the layout of the structure array of hashes of hashes? (because you have .values and then still reject key value pairs?)
<Bish> hm, no "rg" is a model,values are it's values (a hash)
troulouliou_divn has joined #ruby
troulouliou_div2 has quit [Ping timeout: 240 seconds]
dasher00 has joined #ruby
_mossplix has joined #ruby
<Bish> im just wondering why ruby has no syntactic sugar for such things
<Bish> sure i could go with %i(id name).include?(k) but that wouldn't be fast OR pretty
<Bish> also if you have a hash .select { |k,_| } isn't pretty either
absolutejam4 has joined #ruby
<phaul> you can remove ,_
vondruch has joined #ruby
<Bish> then i'd need to call first
<phaul> &>> {a: 1}.select {|k| k == :a}
<rubydoc> # => {:a=>1} (https://carc.in/#/r/7qbk)
<Bish> hue, how does that work
<Bish> has it always been like that for hashes?
<Bish> doesn't work for key value pair arrays tho
<phaul> I *think* it's more to do with argument passing to blocks. But tbh I had to try before I said it
<Bish> phaul: yeah only way for .select to do this is to check the arity of the block
<Bish> but if you do
<Bish> &>> {a:3}.to_a.select {|k| k == :a}
<rubydoc> # => [] (https://carc.in/#/r/7qbl)
<Bish> it breaks apart
<phaul> &>> {a: 1}.each {|k| puts k }
<rubydoc> # => a... check link for more (https://carc.in/#/r/7qbm)
<phaul> &>> {a: 1}.each {|k, v| puts k: k, v: v }
<rubydoc> # => {:k=>:a, :v=>1}... check link for more (https://carc.in/#/r/7qbn)
<phaul> Bish: then don't ;)
ur5us has joined #ruby
<Bish> well i always like the interchangeability between hash / key value pairs
<Bish> it sometimes is handy
<Bish> still odd that there is no way to write essentially %i(id name).freeze.include?(k) as a shorthand
bruce_lee has quit [Ping timeout: 240 seconds]
_mossplix has quit [Remote host closed the connection]
ndrst has quit [Ping timeout: 250 seconds]
<Bish> odd.. it doesn't seem to check the arity of the block
akemhp_ has quit [Ping timeout: 240 seconds]
<phaul> I *think* it's the argument passing rules to blocks. Blocks are quite relaxed on arity.
<Bish> if you give it a proc, it does pass 2 arguments
<Bish> no matter what
_mossplix has joined #ruby
<Bish> that makes it even worse
<Bish> how does someone being picky about performance write something like that jeebus
<phaul> &>> def foo; yield 1, 2, 3; end; foo {|a| p a }
<rubydoc> # => 1... check link for more (https://carc.in/#/r/7qbo)
<phaul> it loses 2 and 3 without a problem...
Intelo has joined #ruby
jeremycw has joined #ruby
jeremycw has quit [Ping timeout: 265 seconds]
ur5us has quit [Remote host closed the connection]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
Swyper has joined #ruby
pi__ has joined #ruby
pi__ has quit [Client Quit]
Pit has joined #ruby
Pit has quit [Client Quit]
_mossplix has quit [Remote host closed the connection]
ajunior_ has joined #ruby
weird_error has joined #ruby
troulouliou_divn has quit [Remote host closed the connection]
troulouliou_div2 has joined #ruby
Fridtjof has quit [Ping timeout: 245 seconds]
weird_error has quit [Quit: weird_error]
ajunior_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
TomyWork has joined #ruby
Fridtjof has joined #ruby
AJA4350 has joined #ruby
ajunior_ has joined #ruby
ajunior_ has quit [Client Quit]
_mossplix has joined #ruby
ajunior_ has joined #ruby
DaniG2k has quit [Quit: leaving]
DTZUZO has joined #ruby
ajunior_ has quit [Client Quit]
ajunior_ has joined #ruby
ajunior_ has quit [Client Quit]
ajunior_ has joined #ruby
nahra has quit [Remote host closed the connection]
_mossplix has quit [Read error: Connection reset by peer]
yann-kaelig has joined #ruby
vondruch_ has joined #ruby
Fernando-Basso has quit [Remote host closed the connection]
DTZUZO has quit [Ping timeout: 276 seconds]
vondruch has quit [Ping timeout: 245 seconds]
vondruch_ is now known as vondruch
cyclonis has quit [Read error: Connection reset by peer]
grilix has joined #ruby
absolutejam4 has quit [Ping timeout: 265 seconds]
absolutejam4 has joined #ruby
DTZUZO has joined #ruby
banisterfiend has joined #ruby
fanta1 has quit [Ping timeout: 264 seconds]
grilix has quit [Read error: Connection reset by peer]
grilix_ has joined #ruby
jmcgnh has quit [Ping timeout: 240 seconds]
AJA4350 has quit [Ping timeout: 245 seconds]
iAmDecim has joined #ruby
cow[moo] has joined #ruby
dbz_ has joined #ruby
ajunior_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
cow[moo] has quit [Ping timeout: 265 seconds]
dbz_ has quit [Ping timeout: 240 seconds]
cyclonis_ has joined #ruby
meinside has quit [Quit: Connection closed for inactivity]
ramfjord has joined #ruby
drincruz has quit [Ping timeout: 245 seconds]
tdy1 has quit [Ping timeout: 265 seconds]
jmcgnh has joined #ruby
ramfjord has quit [Ping timeout: 264 seconds]
Swyper has quit [Remote host closed the connection]
poontangmessiah has joined #ruby
stryek has joined #ruby
mossplix has joined #ruby
jmcgnh has quit [Ping timeout: 240 seconds]
jrafanie has joined #ruby
donofrio has joined #ruby
mossplix has quit [Read error: Connection reset by peer]
mossplix has joined #ruby
mossplix_ has joined #ruby
jmcgnh has joined #ruby
mossplix_ has quit [Read error: Connection reset by peer]
mossplix_ has joined #ruby
mossplix has quit [Read error: Connection reset by peer]
jmcgnh has quit [Excess Flood]
golevka6489 has joined #ruby
golevka has quit [Ping timeout: 264 seconds]
grilix_ has quit [Ping timeout: 250 seconds]
jmcgnh has joined #ruby
luminousnine has quit [Quit: Toodles]
luminousnine- has joined #ruby
luminousnine- has quit [Changing host]
luminousnine- has joined #ruby
cd has joined #ruby
mossplix_ has quit [Read error: Connection reset by peer]
dar123 has joined #ruby
mossplix has joined #ruby
<Bish> is ruby dying? this channel was alot more active a while ago
<Bish> fukin elixir! and all those hip languages!
<Corey[m]> Bish, phaul: You could pass in a lambda that will enforce the arity
<Corey[m]> &>> def foo; yield 1, 2, 3; end; foo(&lambda{|a| p a })
<rubydoc> stderr: -e:4:in `block in <main>': wrong number of arguments (given 3, expected 1) (ArgumentError)... check link for more (https://carc.in/#/r/7qdb)
<Corey[m]> &>> def foo; yield 1, 2, 3; end; foo(&lambda{|a,b,c| p [a, b, c] })
<rubydoc> # => [1, 2, 3]... check link for more (https://carc.in/#/r/7qdc)
mossplix_ has joined #ruby
<Corey[m]> For comparison ^
mossplix has quit [Read error: Connection reset by peer]
nahra has joined #ruby
<Bish> let's not forget that my original problem was to have a pretty version of hash.select { |k| k == y || k == y }
<Bish> which doesn't include generating an array
mossplix has joined #ruby
mossplix_ has quit [Read error: Connection reset by peer]
<Bish> k == y || k == x
schne1der has quit [Ping timeout: 265 seconds]
jmcgnh has quit [Ping timeout: 264 seconds]
lucasb has joined #ruby
ravenousmoose has joined #ruby
drincruz has joined #ruby
ravenousmoose has quit [Client Quit]
KeyJoo has joined #ruby
mikecmpbll has quit [Quit: inabit.]
poontangmessiah has quit [Read error: Connection reset by peer]
troulouliou_div2 has quit [Ping timeout: 265 seconds]
greengriminal has joined #ruby
Mia has joined #ruby
Mia has quit [Changing host]
Mia has joined #ruby
<Corey[m]> Bish: Sorry, I didn't see that, use reduce instead
GodFather has joined #ruby
<Bish> well, how would that look any prettier?
ravenousmoose has joined #ruby
<Bish> or be more performant
jmcgnh has joined #ruby
<Corey[m]> Well for one you'd skip the array construction that select would give you
<Corey[m]> But it won't look 'pretty'
<Bish> oh i didn't mean that array creation
<Bish> i meant the
<Bish> [:id,:name].include? array creation (literal)
<Bish> i suppose you could "chain" the methods with 2.6
<Corey[m]> I'm gonna have to scrollback and find your problem, one moment
ndrst has joined #ruby
ndrst is now known as Guest21040
<Corey[m]> Ah
<Corey[m]> I think I know what you wanted, you want a drop, something to exclude pairs from the model
<Bish> yeah, and a pretty way to do it
<Corey[m]> I just tried a plain hash.drop, it uses the Enumerable one, so you're out of luck there
<Corey[m]> The alternative, is to use multiple deletes
<Corey[m]> Not pretty in the least
<Bish> yep i looked into all the methods thats why i am wondering
<Corey[m]> hash.tap { |h| h.delete(:id); h.delete(:name) }
<Bish> it's not easy to create a block that does what i want and is performant
cow[moo] has joined #ruby
<Bish> well, i might aswell {:id => h[:id], :name => h[:name]}
<Bish> or even
<Bish> [:id,:name].map { |k| [k,h[k]] }.to_h
<Corey[m]> Ah
<Corey[m]> You want a take now
<Corey[m]> Use hash.slice
<Corey[m]> If you have it
<Bish> lol, okay, why that method
* Bish google
<Corey[m]> Lemme show you
<Corey[m]> &>> {a: 2, b: 3, c: 4}.slice(:a, :b)
<rubydoc> # => {:a=>2, :b=>3} (https://carc.in/#/r/7qdg)
<Bish> no, it works
<Bish> i used it, but i wonder why i never seen that
<Bish> it's an odd name for a hash
<Corey[m]> Well... I'm one of those elixir converts (prepares to get stoned to death)
<Bish> bleh
<Bish> gonna hear alot of elixir at the end of this motnh i again i suppose
cow[moo] has quit [Read error: Connection reset by peer]
<havenwood> Bish: In 2.6, you can #to_h with a block:
<havenwood> %i[id name].to_h { |k| [k, h[k]] }
<Bish> hm, i don't know if that's better or rowse :o
<havenwood> Bish: Different than #slice in that it'll give default args: {:id=>nil, :name=>nil}
<havenwood> When neither key present: h.slice(:id, :name) #=> {}
<havenwood> Bish: Saves a method call and intermediary Array.
<havenwood> Just `to_h { }` instead of `map { }.to_h`.
<Bish> Corey[m]: what is elixir good at anyways?
mossplix has quit [Remote host closed the connection]
mossplix has joined #ruby
<Corey[m]> Bish: It depends on what you want out of your language I suppose, binary pattern matching, immutable data, concurrency out of the box
<Corey[m]> Can I stress binary pattern matching?
<Bish> what is that exactly?
<Bish> like ruby's a,b = [1,2] just everywhere?
<Corey[m]> Let's say you have a ISO8601 timestamp, `2019-08-01T00:23:10Z`
<nisstyre> I mean, Erlang has that too
<nisstyre> :p
<Bish> i mean haskell ONLY has that
<nisstyre> Haskell does not have binary pattern matching
<nisstyre> at least not out of the box
<Bish> well, i don't know yet what exactly it is
<havenwood> I didn't implement binary pattern matching >.> (that'd be fun), but here was my stab at Elixir stdlib in Ruby: https://github.com/havenwood/elixir.rb
<nisstyre> you can use OverloadedStrings maybe
<Corey[m]> nisstyre: P: really
<Bish> how is that a cool feature?
<Bish> i mean what can u use it for
<havenwood> I'd like Stream.unfold/2 in Ruby.
<nisstyre> Bish: writing network protocol parsers
<nisstyre> image parsers
<nisstyre> anything like that
<Corey[m]> havenwood: I'd run back to ruby in a flash if it has binary pattern matching, believe me
<Bish> yeah i do that everyday
<Corey[m]> It made parsing heaven
<Corey[m]> parsing in general
<Bish> that's a weird thing to say
<nisstyre> Erlang is really good at dealing with parsing binary streams
<Bish> i bet you can write a DSL that does abstract that quite beautifully
<nisstyre> so?
<nisstyre> why go to the effort?
<Corey[m]> nisstyre: And elixir is built atop BEAM and use erlang
<nisstyre> yep
<Bish> well, i never had the need, i was referring to the fact "he would come back if ruby had that"
<Corey[m]> So I get the best of both worlds
<havenwood> Corey[m]: I'm glad Matz is enjoying Elixir. I was glad to see a more usable, non-case pattern matching commit on trunk.
<Bish> if i wrote parsers with ruby i always were happy with pack and stuff
<nisstyre> you've probably never tried writing a parser with pattern matching and without
<nisstyre> it ends up being a lot fewer lines with pattern matching
<Bish> well, i also never write parsers
<nisstyre> you probably do, you just don't call them that
<Bish> i doubt it
<nisstyre> how often do you split strings by a delimiter?
<havenwood> Corey[m]: The new syntax is: if json in {foo:, bar:}
<nisstyre> or break them up into tokens
* Bish greps his job-project for split
<nisstyre> how often do you shell out to the system for some command and use the output?
<Bish> also never
<nisstyre> clearly you've never had to do much automation then
<Bish> well, how so?
<Bish> i have docker for such tasks
<nisstyre> docker is for containerization
<Bish> yeah, but what task would i have to automate
<Bish> in a usual web-app
<Corey[m]> havenwood: Is json a hash in this case, and you can partially match against another hash, does foo and bar get stored into a local variable I can use inside the if block?
<nisstyre> in a web app? I have no idea
<havenwood> Corey[m]: yes!
<Corey[m]> havenwood: Thanks I'll give it a look
<nisstyre> but not everyone writes just web apps, anyway it doesn't really matter
<havenwood> Corey[m]: The syntax is experimental, so it might be yanked, and there are admittedly edge cases that could be problematic for this implementation. Still, I find it super enouraging.
<Bish> i don't get why automation implies using external programs and pipes
chalkmonster has joined #ruby
<Bish> and why that would imply i had to parse that output (with or without binary pattern matching)
Rapture has joined #ruby
dviola has joined #ruby
<nisstyre> Bish: say you have a bunch of servers and you want to figure out how long they've been up. All you have is SSH access. How would you do that without calling `uptime` on them?
<Corey[m]> havenwood: I'm just glad that ruby is still trying new things, even with all the "ruby is dying" going around
<Bish> hm, i wrote a tool for that, or rather i am making in a tool for that
<havenwood> Corey[m]: Even type signatures!
<Bish> it's an automation tool
<bougyman> nisstyre: well you messed up a long time ago if you don't already know uptime of those servers :)
<bougyman> monitor much?
<Bish> which one would you parse, /proc/self/auxv or the output of "uptime"
<Corey[m]> havenwood: Interesting
<Bish> i don't know, it sounds like regex with benefits
dar123 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Mia has quit [Read error: Connection reset by peer]
<Bish> i suppose it's fast, tho
grilix_ has joined #ruby
<Corey[m]> Bish: I'd find it easier to deal with auxv once I read the spec for the structure
DTZUZO_ has joined #ruby
<Bish> well, but you find a "c struct to ruby parser" thingie for sure, why would you go the hazzle to write it
Mia has joined #ruby
Mia has quit [Changing host]
Mia has joined #ruby
Rapture_ has joined #ruby
<Corey[m]> Bish: personally I enjoy the challenge of parsing a binary format, not sure anyone else would
Rapture has quit [Ping timeout: 264 seconds]
jmcgnh has quit [Ping timeout: 265 seconds]
<Bish> well, if it's a simple struct, a binary pattern matching whatever thing is not really helpful
DTZUZO has quit [Ping timeout: 264 seconds]
<bougyman> Binary parsers are fun and all, but it's been a small minority of parsing over the years.
<bougyman> MOst is far more simple.
<bougyman> while read up idle; do echo $((up/60)) seconds; done < /proc/uptime
<bougyman> 2119.3218333333334 seconds
<bougyman> and such.
bogn has joined #ruby
<Bish> datpatternmatch.png
<Corey[m]> touche`
jeremycw has joined #ruby
<nisstyre> bougyman: just an example
<nisstyre> it could be anything, like getting versions of packages off of it
<nisstyre> pre-existing tools don't always exist that do exactly what you want
<Corey[m]> In my case it's dealing with SMPP
<bougyman> Other than wire protocols, the most common reason for me to want a pattern matching parser has been for syntax highlighting I think, heh.
<nisstyre> writing anything using recursion becomes much easier with pattern matching
<bougyman> It's lovely for wire protocols, for certain.
chalkmonster has quit [Quit: WeeChat 2.6]
<nisstyre> and actor-model style programs that do different things depending on the messages sent to a method
<bougyman> But I've always used LISP for those.
<bougyman> cause it's better than * at recursion, pattern matching, and templating.
<nisstyre> yes, I use Racket for that
<nisstyre> I'm not arguing that Ruby is better than Racket there
<bougyman> Racket is a hipster lisp variant, is it?
jmcgnh has joined #ruby
<nisstyre> just pointing out use cases for it
<nisstyre> Scheme
<bougyman> Right.
Intelo has quit [Remote host closed the connection]
<havenwood> "If you ... do like the concept of LISP, but don't like too many parentheses, Ruby might be your language of choice."
<havenwood> Straight from the Ruby manpage.
<havenwood> I thought CHICKEN scheme was the hipster LISP? Or is that Ruby? :P
SeepingN has joined #ruby
<nisstyre> yeah Racket is the snooty academic lisp
<nisstyre> Guile is the free software neckbeard lisp
conta1 has quit [Ping timeout: 240 seconds]
<nisstyre> Chicken/Gambit/etc are the ones nobody uses
<bougyman> eh, I'm on the CL side of things.
<nisstyre> MIT Scheme is the one from those funny videos
<bougyman> I'm too spoiled by CLoS
ravenousmoose has quit [Ping timeout: 252 seconds]
* Corey[m] scoots away from the lisp crowd
jmcgnh_ has joined #ruby
jmcgnh has quit [Ping timeout: 265 seconds]
jmcgnh_ is now known as jmcgnh
jmcgnh is now known as jmcgnh_
jmcgnh_ is now known as jmcgnh
jmcgnh is now known as jmcgnh_
jmcgnh_ is now known as jmcgnh
freedom has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
Mia has quit [Read error: Connection reset by peer]
Mia has joined #ruby
Mia has joined #ruby
Mia has quit [Changing host]
greengriminal has quit [Quit: This computer has gone to sleep]
KeyJoo has quit [Quit: KeyJoo]
schne1der has joined #ruby
brool has joined #ruby
greengriminal has joined #ruby
mossplix has quit [Remote host closed the connection]
mossplix has joined #ruby
RiPuk has quit [Ping timeout: 240 seconds]
mossplix has quit [Ping timeout: 240 seconds]
absolutejam4 has quit [Ping timeout: 268 seconds]
mossplix has joined #ruby
jmcgnh has quit [Ping timeout: 252 seconds]
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mossplix has quit [Ping timeout: 240 seconds]
Inline has joined #ruby
jmcgnh has joined #ruby
wildtrees has joined #ruby
kilic has joined #ruby
<kilic> Hello
wildtrees has quit [Remote host closed the connection]
wildtrees has joined #ruby
andikr has quit [Remote host closed the connection]
Swyper has joined #ruby
cthulchu_ has quit [Ping timeout: 245 seconds]
Swyper has quit [Remote host closed the connection]
dviola has quit [Quit: WeeChat 2.6]
Swyper has joined #ruby
TomyWork has quit [Ping timeout: 246 seconds]
Ai9zO5AP has quit [Ping timeout: 240 seconds]
mossplix has joined #ruby
sgen has joined #ruby
kilic has quit [Ping timeout: 265 seconds]
dar123 has joined #ruby
Jonopoly has quit [Quit: WeeChat 2.5]
Ai9zO5AP has joined #ruby
Guest47 has joined #ruby
iAmDecim has quit [Ping timeout: 240 seconds]
fphilipe has quit [Ping timeout: 246 seconds]
Guest47 has left #ruby [#ruby]
yann-kaelig has quit [Quit: yann-kaelig]
Swyper has quit [Remote host closed the connection]
yokel has quit [Ping timeout: 268 seconds]
yokel has joined #ruby
kilic has joined #ruby
ellcs has quit [Ping timeout: 264 seconds]
<brool> i'm trying to nest one sinatra app in a subfolder of another. so in config.ru i have map '/' run my main website app, and map '/hangman' runs a hangman app located in /my/website/hangman. i have public & view dirs in /hangman such as /hangman/public etc. now when i go to localhost/hangman i get the view, but none of the javascript is loading, which are in ./hangman/public, and i can't find a setting in the
<brool> sinatra app that will make them load
orbyt_ has joined #ruby
<brool> oh nevermind i had to change my URIs in the view to prepend /hangman/
iAmDecim has joined #ruby
brendan- has joined #ruby
cthulchu has joined #ruby
iAmDecim has quit [Ping timeout: 240 seconds]
fphilipe has joined #ruby
Rapture_ has quit [Ping timeout: 240 seconds]
jacksoow has quit [Ping timeout: 264 seconds]
jacksoow has joined #ruby
ramfjord has joined #ruby
davor_ has joined #ruby
davor has quit [Ping timeout: 240 seconds]
davor_ is now known as davor
kilic1 has joined #ruby
dionysus69 has quit [Ping timeout: 240 seconds]
jud has quit [Ping timeout: 240 seconds]
Mia has quit [Read error: Connection reset by peer]
Mia has joined #ruby
Mia has quit [Changing host]
Mia has joined #ruby
tdy1 has joined #ruby
joast has quit [Ping timeout: 240 seconds]
SCHAPiE has quit [Quit: ZNC - https://znc.in]
SCHAPiE has joined #ruby
poontangmessiah has joined #ruby
lightstalker has quit [Remote host closed the connection]
lightstalker has joined #ruby
freedom has quit [Ping timeout: 264 seconds]
TechIsCool has joined #ruby
<TechIsCool> Anyone know how to ask ruby for the current ca certificates used for validation
<TechIsCool> I am on windows and I can't seem to find them
ramfjord has quit [Ping timeout: 246 seconds]
joast has joined #ruby
<TechIsCool> I know I can override them but I want to determine which version I need to upgrade to. To support my public CAs cert
<TechIsCool> Currently I run cert = Net::HTTP.start('firehose.us-west-2.amazonaws.com', '443', use_ssl: true) { |http| http.peer_cert }
<TechIsCool> and it cries saying the certificate is not valid
ellcs has joined #ruby
<adam12> TechIsCool: That line of code fails for you?
<TechIsCool> Correct
<TechIsCool> I am running a pretty old version of fluentd that has 2.3.0 bundled
<TechIsCool> I know that 2.4.0 works but I was trying to determine if I had to upgrade in place or could just ask ruby to update the CA certs
<adam12> TechIsCool: It runs fine for me.
poontangmessiah has quit [Read error: Connection reset by peer]
<adam12> TechIsCool: What's the error you see? and what platform?
<TechIsCool> windows x64
<TechIsCool> SSL_connect returned=1 errno=0 state=error: certificate verify failed
<TechIsCool> is the error
<adam12> TechIsCool: Interesting. Are you using WSL or are native Windows?
<TechIsCool> native windows
<adam12> TechIsCool: Using cmd.exe? I'm not super familiar so just trying to get an idea.
<adam12> TechIsCool: Not sure this is a Ruby thing tho, since it normally delegates to OpenSSL.
<TechIsCool> I was using irb.exe
<TechIsCool> to do the validation
<also_uplime> irb just calls ruby code
<also_uplime> its not validating any certificates
<TechIsCool> so does rubygems manage the ca certs for ruby
<havenwood> TechIsCool: Show us the output of running this code? https://github.com/rubygems/ruby-ssl-check/blob/master/check.rb
Nicmavr has quit [Read error: Connection reset by peer]
<havenwood> TechIsCool: You might consider switching to WSL2.
<TechIsCool> its all embedded fluentd stuff
<TechIsCool> not my code
<TechIsCool> just trying to stream data to kinesis
Nicmavr has joined #ruby
kilic1 has quit [Ping timeout: 240 seconds]
ramfjord has joined #ruby
dionysus69 has joined #ruby
<Iambchop> TechIsCool: how was fluentd installed? td-agent.msi?
<TechIsCool> Yup
<TechIsCool> specifically this package
<TechIsCool> I now see that most of our infra is actually running the newer 3.3.0 version
<TechIsCool> So I am thinking this is a none issue and we just failed at bumping foward the version pin in the kitchen instances we where testing in
kilic-desktop has joined #ruby
kilic-desktop has quit [Client Quit]
Mia has quit [Read error: Connection reset by peer]
hays_ has quit [Ping timeout: 240 seconds]
hays_ has joined #ruby
hiroaki_ has joined #ruby
Mia has joined #ruby
Mia has quit [Changing host]
Mia has joined #ruby
ravenousmoose has joined #ruby
Rapture has joined #ruby
kilic has quit [Remote host closed the connection]
akemhp has joined #ruby
dar123 has left #ruby ["Textual IRC Client: www.textualapp.com"]
davor has quit [Ping timeout: 240 seconds]
freedom has joined #ruby
davor has joined #ruby
freedom has quit [Client Quit]
mn3m has quit [Ping timeout: 240 seconds]
hays_ has quit [Remote host closed the connection]
hays_ has joined #ruby
ramfjord has quit [Ping timeout: 268 seconds]
jrafanie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jrafanie has joined #ruby
bambanx has joined #ruby
gix has joined #ruby
banisterfiend has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ellcs has quit [Ping timeout: 245 seconds]
rippa has joined #ruby
Tempesta has quit [Quit: AdiIRC is updating to v3.6 Beta Build (2019/10/07 UTC) 64 Bit]
Tempesta has joined #ruby
ellcs has joined #ruby
sgen has quit [Ping timeout: 250 seconds]
absolutejam4 has joined #ruby
Intelo has joined #ruby
drincruz has quit [Ping timeout: 240 seconds]
hays_ has quit [Remote host closed the connection]
hays_ has joined #ruby
postmodern has joined #ruby
bogn has quit [Ping timeout: 265 seconds]
akemhp_ has joined #ruby
akemhp has quit [Ping timeout: 240 seconds]
ravenousmoose has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
lxsameer has quit [Ping timeout: 252 seconds]
Mia has quit [Read error: Connection reset by peer]
hightower2 has joined #ruby
hiroaki_ has quit [Ping timeout: 252 seconds]
drincruz has joined #ruby
dionysus69 has quit [Ping timeout: 246 seconds]
Intelo has quit [Ping timeout: 246 seconds]
iAmDecim has joined #ruby
Intelo has joined #ruby
iAmDecim has quit [Ping timeout: 240 seconds]
banisterfiend has joined #ruby
iAmDecim has joined #ruby
gigetoo has quit [Ping timeout: 276 seconds]
Tinto_Brass has joined #ruby
Fernando-Basso has joined #ruby
CableNinja_ has joined #ruby
gigetoo has joined #ruby
ur5us has joined #ruby
<CableNinja_> hey all, I'm reading a file from a site as JSON, in some of the nodes is a path, but I want to create that path so that its a ruby variable in the json, and then parsed when I read it in. EX JSON: { "target": "#{baseDir}/path/" }
<CableNinja_> right now it just reads is exactly as that, and then I end up with the final string being "#{baseDir}/path/myfile"
<CableNinja_> (literal, unparsed #{baseDir})
<CableNinja_> running eval against the string's variable doesnt seem to work (EX: eval(filePath) )
fphilipe has quit [Ping timeout: 268 seconds]
<havenwood> CableNinja_: Is baseDir a local variable or a method?
<havenwood> CableNinja_: Ruby convention would be camel_case for either, no headlessCamelCase in Ruby.
<havenwood> CableNinja_: What doesn't work about evaling?
<CableNinja_> baseDir is a local var
<CableNinja_> hold on I'll paste code
schne1der has quit [Ping timeout: 276 seconds]
ramfjord has joined #ruby
<adam12> CableNinja_: Not to sidetrack you too much, but I'd probably look at using sprintf/format instead of eval. You could then do something like `"target": "%<basedir>s/path/"` and format it with `format(target, { basedir: basedir, moreStuff: here })`. Less risk and more control.
<adam12> CableNinja_: Unless you're purposely allowing flow control/etc.
<havenwood> &>> base_dir = '/foo'; sprintf "%<base_dir>s/path", {base_dir: base_dir}
<rubydoc> # => "/foo/path" (https://carc.in/#/r/7qod)
galaxie has quit [Remote host closed the connection]
<CableNinja_> adam12, that sounds like a better idea, I can manage that
<havenwood> adam12: format is a nicer word, huh?
galaxie has joined #ruby
<havenwood> adam12: you beat me to it. :)
SCHAPiE has quit [Quit: ZNC - https://znc.in]
<havenwood> CableNinja_: It seems Kernel#sprintf suffices for your case here, but if you want to do templating there's always ERB: https://gist.github.com/havenwood/4469e3975ce0b597e00a3cf205dea4bb
<adam12> havenwood: I think using sprintf cripples the self-expanatory name of it, since it has the nice bits about supporting named arguments. If it was a dumb wrapper about sprintf in C then I'd argue that format is a horrible name :P
<havenwood> adam12: and either is less confusing than %
<adam12> havenwood: Tho both are better IMHO than String#% when it comes to explainging to newcomers what it is.
<adam12> lol
<havenwood> agreed
<adam12> It's already a challenge explaining where some things come from (ala Kernel)
<adam12> CableNinja_: I still recommend String#format, but just for clarity, you're example would of worked with a second wrapping of quotes. You created a string but instance eval would of expected a string of Ruby code (a string with a string).
<adam12> &>> target = '#{baseDir}/lib/'; instance_eval('"#{target}"')
<rubydoc> # => "\#{baseDir}/lib/" (https://carc.in/#/r/7qoj)
<adam12> Bad example.
<adam12> &>> target = '"#{baseDir}/lib/"'; instance_eval(target)
<rubydoc> stderr: (eval):1:in `<main>': undefined local variable or method `baseDir' for main:Object (NameError)... check link for more (https://carc.in/#/r/7qok)
<adam12> Eh you get the idea.
nowhere_man has joined #ruby
SCHAPiE has joined #ruby
<CableNinja_> adam12, your suggestion worked for format(), thanks
<CableNinja_> eval is a crazy piece of work I try to avoid at all costs, but I couldnt think of a better way of doin it, heh
<havenwood> &>> require 'erb'; base_path = '/foo'; ERB.new("<%= base_path %>/bar/baz").result(binding)
<rubydoc> # => "/foo/bar/baz" (https://carc.in/#/r/7qol)
Ai9zO5AP has quit [Ping timeout: 265 seconds]
AJA4350 has joined #ruby
mossplix has quit [Remote host closed the connection]
golevka6489 is now known as golevka
grilix_ has quit [Ping timeout: 245 seconds]
sameerynho has joined #ruby
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
Ai9zO5AP has joined #ruby
ramfjord has quit [Ping timeout: 252 seconds]
ellcs has quit [Ping timeout: 276 seconds]
ramfjord has joined #ruby
nowhereman has joined #ruby
nowhere_man has quit [Ping timeout: 276 seconds]
CableNinja_ has quit [Read error: Connection reset by peer]
CableNinja_ has joined #ruby
ellcs has joined #ruby
brendan- has quit [Read error: Connection reset by peer]
Mia has joined #ruby
Mia has quit [Changing host]
Mia has joined #ruby
absolutejam4 has quit [Ping timeout: 246 seconds]
brendan- has joined #ruby
greengriminal has quit [Quit: Leaving]
ged has joined #ruby
Mia has quit [Read error: Connection reset by peer]
Mia has joined #ruby
Mia has quit [Changing host]
Mia has joined #ruby
nowhereman has quit [Ping timeout: 265 seconds]
nowhereman has joined #ruby
Swyper has joined #ruby
Rapture has quit [Quit: Textual IRC Client: www.textualapp.com]
weird_error has joined #ruby
ur5us has quit [Read error: Connection reset by peer]
ur5us has joined #ruby
sameerynho has quit [Ping timeout: 250 seconds]
nemesit|znc has quit [Ping timeout: 246 seconds]
quazimodo has quit [Read error: Connection reset by peer]
jeremycw has quit [Ping timeout: 252 seconds]
weird_error has quit [Quit: weird_error]
CableNinja_ has quit [Ping timeout: 240 seconds]
hyperreal has joined #ruby
<hyperreal> Hello. Is there are Ruby equivalent to Python's subprocess module?
Mia has quit [Read error: Connection reset by peer]
<havenwood> hyperreal: I'd think Open3 https://docs.ruby-lang.org/en/2.6.0/Open3.html
Fernando-Basso has quit [Remote host closed the connection]
<hyperreal> havenwood: thanks
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 265 seconds]
AJA4351 is now known as AJA4350
Mia has joined #ruby
Mia has quit [Changing host]
Mia has joined #ruby
ramfjord has quit [Ping timeout: 250 seconds]
cyclonis_ has quit [Ping timeout: 276 seconds]
xGrind has joined #ruby
edwardly has quit [Read error: Connection reset by peer]
gigetoo has quit [Ping timeout: 276 seconds]
yokel has quit [Ping timeout: 276 seconds]
gigetoo has joined #ruby
weird_error has joined #ruby
edwardly has joined #ruby
edwardly has quit [Changing host]
edwardly has joined #ruby
jacksoow has quit [Read error: Connection reset by peer]
Tinto_Brass has quit [Quit: Bye Bye]
nemesit|znc has joined #ruby
jacksoow has joined #ruby
cyclonis has joined #ruby
yokel has joined #ruby
ellcs has quit [Ping timeout: 264 seconds]
gavlee has quit []
cyclonis has quit [Read error: Connection reset by peer]
dbugger has quit [Quit: Leaving]
witlesswonder has joined #ruby
cyclonis has joined #ruby
Danishman has joined #ruby
Swyper has quit [Remote host closed the connection]
drincruz has quit [Ping timeout: 240 seconds]
mossplix has joined #ruby
hays__ has joined #ruby
fuzzface has joined #ruby
<hays__> slightly off topic, but curious if anyone here has tried to build ruby using macos homebrew / rbenv using the macos catalina toolchain yet
<also_uplime> i use ruby with rvm/homebrew on catalina
<hays__> have you built a ruby from source
<also_uplime> all of my rubies are built from source
<hays__> run into any difficulties or was it all good?
<also_uplime> it was all good
<hays__> xcode 11?
iAmDecim has quit [Ping timeout: 240 seconds]
ramfjord has joined #ruby
<also_uplime> probably better to just ask your actual question
<hays__> just trying not to be the first person to upgrade :)
jud has joined #ruby
cyclonis has quit [Quit: -a- Connection Timed Out]
mossplix has quit [Remote host closed the connection]
cyclonis has joined #ruby
cjohnson has joined #ruby
jrafanie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 240 seconds]
AJA4351 is now known as AJA4350
Swyper has joined #ruby
Tinto_Brass has joined #ruby
brendan- has quit [Read error: Connection reset by peer]