havenwood changed the topic of #ruby to: Rules & more: https://ruby-community.com | Ruby 2.6.4, 2.5.6, 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!
cagomez has quit [Ping timeout: 258 seconds]
cagomez has joined #ruby
cagomez has quit [Read error: Connection reset by peer]
mtuckerbradford has joined #ruby
Guest15733 has joined #ruby
ellcs has quit [Ping timeout: 264 seconds]
ramfjord has quit [Ping timeout: 245 seconds]
Guest15733 has quit [Ping timeout: 244 seconds]
smurfendrek123_ has quit [Ping timeout: 268 seconds]
gell5 has joined #ruby
gell5 has quit [Ping timeout: 246 seconds]
mtuckerbradford has quit [Ping timeout: 244 seconds]
tpanarch1st_ has joined #ruby
tpanarch1st has quit [Ping timeout: 258 seconds]
r29v has joined #ruby
r29v has quit [Client Quit]
r29v has joined #ruby
cd has quit [Ping timeout: 245 seconds]
smurfendrek123_ has joined #ruby
crankharder has joined #ruby
ramfjord has joined #ruby
poontangmessiah has quit [Read error: Connection reset by peer]
ramfjord has quit [Ping timeout: 245 seconds]
r29v has quit [Quit: r29v]
gell5 has joined #ruby
r29v has joined #ruby
gell5 has quit [Ping timeout: 244 seconds]
r29v has quit [Quit: r29v]
blizzow has joined #ruby
r29v has joined #ruby
r29v has quit [Client Quit]
r29v has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dinfuehr has quit [Ping timeout: 244 seconds]
Azure has quit [Read error: Connection reset by peer]
dinfuehr has joined #ruby
Azure has joined #ruby
r29v has quit [Quit: r29v]
r29v has joined #ruby
SeepingN has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
baojg has quit [Ping timeout: 246 seconds]
r29v has quit [Ping timeout: 245 seconds]
Nicmavr has quit [Read error: Connection reset by peer]
r29v has joined #ruby
Nicmavr has joined #ruby
r29v has quit [Client Quit]
blizzow has quit [Ping timeout: 258 seconds]
r29v has joined #ruby
banisterfiend has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
SeepingN has joined #ruby
r29v has quit [Client Quit]
baojg has joined #ruby
brool has quit [Ping timeout: 264 seconds]
Guest15733 has joined #ruby
DaRock has joined #ruby
queip has quit [Ping timeout: 244 seconds]
queip has joined #ruby
gix- has joined #ruby
gix has quit [Disconnected by services]
SeepingN has quit [Quit: The system is going down for reboot NOW!]
Omnilord has quit [Quit: This computer has gone to sleep]
Esa_ has quit []
td123 has joined #ruby
ramfjord has joined #ruby
Guest15733 has quit [Ping timeout: 245 seconds]
ramfjord has quit [Ping timeout: 258 seconds]
Omnilord has joined #ruby
gell5 has joined #ruby
Freshnuts has joined #ruby
gell5 has quit [Ping timeout: 244 seconds]
Omnilord has quit [Quit: Leaving]
Guest15733 has joined #ruby
arahael has joined #ruby
AJA4350 has quit [Quit: AJA4350]
gell5 has joined #ruby
crankharder has quit [Quit: Lost terminal]
gell5 has quit [Ping timeout: 258 seconds]
Guest15733 has quit [Ping timeout: 246 seconds]
polishdub has joined #ruby
tsujp has joined #ruby
smurfendrek123_ has quit [Ping timeout: 245 seconds]
gell5 has joined #ruby
gell5 has quit [Ping timeout: 245 seconds]
Guest15733 has joined #ruby
Guest15733 has quit [Ping timeout: 245 seconds]
DaRock has quit [Ping timeout: 246 seconds]
x86sk has quit [Quit: Connection closed for inactivity]
orbyt_ has joined #ruby
x86sk has joined #ruby
jhass has quit [Read error: Connection reset by peer]
polishdub has quit [Ping timeout: 246 seconds]
gell5 has joined #ruby
Guest15733 has joined #ruby
queip has quit [Ping timeout: 258 seconds]
gell5 has quit [Ping timeout: 245 seconds]
beanie__ has joined #ruby
tpanarch1st_ has quit [Ping timeout: 258 seconds]
queip has joined #ruby
Freshnuts has quit [Quit: Leaving]
Freshnuts has joined #ruby
sauvin has joined #ruby
dinfuehr has quit [Ping timeout: 245 seconds]
dinfuehr has joined #ruby
dinfuehr has quit [Ping timeout: 246 seconds]
dinfuehr has joined #ruby
Technodrome has joined #ruby
absolutejam has joined #ruby
Guest15733 has quit [Ping timeout: 244 seconds]
dbugger has joined #ruby
MrCrackPot has quit [Ping timeout: 245 seconds]
rvca has joined #ruby
dionysus69 has joined #ruby
rvca has quit [Client Quit]
rvca has joined #ruby
MrCrackPot has joined #ruby
MrCrackPot has quit [Remote host closed the connection]
DaRock has joined #ruby
MrCrackPot has joined #ruby
dionysus69 has quit [Ping timeout: 245 seconds]
queip has quit [Ping timeout: 245 seconds]
Guest15733 has joined #ruby
tdy has joined #ruby
Guest15733 has quit [Ping timeout: 246 seconds]
queip has joined #ruby
Guest15733 has joined #ruby
Guest15733 has quit [Ping timeout: 258 seconds]
gell5 has joined #ruby
shortCircuit__ has joined #ruby
rvca has quit [Ping timeout: 264 seconds]
gell5 has quit [Ping timeout: 245 seconds]
shortCircuit__ has quit [Ping timeout: 258 seconds]
Ven`` has joined #ruby
absolutejam has quit [Quit: WeeChat 2.5]
shortCircuit__ has joined #ruby
Guest15733 has joined #ruby
dbugger has quit [Quit: Leaving]
gell5 has joined #ruby
queip has quit [Ping timeout: 245 seconds]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gell5 has quit [Ping timeout: 244 seconds]
RiPuk has quit [Quit: ZNC 1.7.4 - https://znc.in]
RiPuk has joined #ruby
queip has joined #ruby
michael_mbp has quit [Ping timeout: 268 seconds]
schneider has joined #ruby
dbugger has joined #ruby
schneider has quit [Ping timeout: 246 seconds]
michael_mbp has joined #ruby
beanie__ has quit [Ping timeout: 258 seconds]
dbugger has quit [Remote host closed the connection]
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Guest15733 has quit [Ping timeout: 244 seconds]
sameerynho has joined #ruby
Ven`` has quit [Read error: Connection reset by peer]
chalkmonster has joined #ruby
dionysus69 has joined #ruby
dionysus70 has joined #ruby
x86sk has quit [Quit: Connection closed for inactivity]
dionysus69 has quit [Ping timeout: 245 seconds]
dionysus70 is now known as dionysus69
pwnd_nsfw has quit [Ping timeout: 245 seconds]
Guest15733 has joined #ruby
pwnd_nsfw has joined #ruby
shortCircuit__ has quit [Ping timeout: 244 seconds]
conta has joined #ruby
smurfendrek123_ has joined #ruby
cd has joined #ruby
involans has joined #ruby
chalkmonster has quit [Quit: WeeChat 2.5]
hiroaki has quit [Ping timeout: 245 seconds]
nahra has joined #ruby
nahra has joined #ruby
nahra has quit [Client Quit]
nahra has joined #ruby
nahra has joined #ruby
involans has quit [Quit: involans]
gell5 has joined #ruby
smurfendrek123_ has quit [Ping timeout: 246 seconds]
gell5 has quit [Ping timeout: 246 seconds]
banisterfiend has joined #ruby
gell5 has joined #ruby
gell5 has quit [Ping timeout: 258 seconds]
Freshnuts has quit [Quit: Leaving]
lipoqil has quit [Quit: Connection closed for inactivity]
ur5us has joined #ruby
poontangmessiah has joined #ruby
AJA4350 has joined #ruby
banisterfiend has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
duderonomy has joined #ruby
dionysus69 has quit [Ping timeout: 245 seconds]
gell5 has joined #ruby
duderono_ has joined #ruby
duderonomy has quit [Ping timeout: 245 seconds]
gell5 has quit [Ping timeout: 246 seconds]
Technodrome has joined #ruby
Fernando-Basso has joined #ruby
lipoqil has joined #ruby
dionysus69 has joined #ruby
tsrt^ has quit []
queip has quit [Ping timeout: 246 seconds]
queip has joined #ruby
Fr4n has joined #ruby
ur5us has quit [Read error: Connection reset by peer]
ur5us has joined #ruby
Intelo has quit [Ping timeout: 244 seconds]
queip has quit [Ping timeout: 246 seconds]
nahra has quit [Quit: leaving]
lnh^ has joined #ruby
queip has joined #ruby
shortCircuit__ has joined #ruby
shortCircuit__ has quit [Ping timeout: 245 seconds]
schaerli has joined #ruby
schaerli has quit [Ping timeout: 244 seconds]
Inline__ has joined #ruby
Inline has quit [Ping timeout: 264 seconds]
Intelo has joined #ruby
Ekho has quit [Quit: An alternate universe was just created where I didn't leave. But here, I left you. I'm sorry.]
lucasb has joined #ruby
Ekho has joined #ruby
ebarrett has joined #ruby
<ebarrett> Does anyone know to what extend Ruby 2.x is backward compatible with 1.8?
<havenwood> ebarrett: It's largely the same language. The 1.8 to 1.9 changes were the biggest. Why do you ask?
<ebarrett> ah, i didn't realise there was a 1.9
<ebarrett> I'm the packager of tex live for OpenBSD
Intelo has quit [Ping timeout: 245 seconds]
<ebarrett> there are a lot of scripts with #!/usr/bin/env ruby1.8
<ebarrett> but we don't package ruby-1.x any more
<ebarrett> I'm wondering if it's gonna cause problems
ramfjord has joined #ruby
<havenwood> ebarrett: That does seem likely to cause problems The VM introduced in 1.9 has more breaking changes than any subsequent version of Ruby by far.
<ebarrett> eesh
Intelo has joined #ruby
<havenwood> ebarrett: Matz was unhappy with the amount of thing that broke and decided not to make such big changes as 1.8 to 1.9 in the future.
<ebarrett> the pure scale of tex live makes it kind of impossible to systematically fix
<havenwood> mmm, i imagine!
<ebarrett> i guess I'll be changing the shebangs and waiting for user reports of breakage
<havenwood> good luck!
<ebarrett> thanks
GodFather has quit [Ping timeout: 245 seconds]
chalkmonster has joined #ruby
ramfjord has quit [Ping timeout: 244 seconds]
Milos has quit [Ping timeout: 244 seconds]
lalitmee has joined #ruby
thadtheman has joined #ruby
Nicmavr has quit [Read error: Connection reset by peer]
<thadtheman> I'm running an old ruby program, I do the following: IO.popen("Blah blah").readlines.each{|l|("yada"l}; error_no=$? ... When I look at eror_no it is nil. Why?
Nicmavr has joined #ruby
Milos has joined #ruby
<havenwood> thadtheman: is the "l" a typo? the .opopen line isn't running?
Inline__ has quit [Quit: Leaving]
<thadtheman> havenwood: no the l is not a typo. IOf you want to modify the command. IO.popen("Blah blah").readlines.each{|l|(puts l}; error_no=$?
gell5 has joined #ruby
gell5 has quit [Ping timeout: 258 seconds]
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
psilly0 has joined #ruby
ravenous_ has joined #ruby
john2496 has joined #ruby
psilly0 has quit [Quit: psilly0]
john2496 has quit [Ping timeout: 245 seconds]
ebarrett has quit [Quit: WeeChat 2.4]
cthulchu has quit [Ping timeout: 245 seconds]
ur5us has quit [Remote host closed the connection]
bga57 has quit [Quit: Leaving.]
john2496 has joined #ruby
bga57 has joined #ruby
ellcs has joined #ruby
john2496 has quit [Ping timeout: 244 seconds]
ellcs has quit [Ping timeout: 264 seconds]
za1b1tsu has joined #ruby
queip has quit [Ping timeout: 245 seconds]
queip has joined #ruby
greengriminal has joined #ruby
darris has quit [Quit: Bye bye!]
kitallis| has quit [Quit: ZNC 1.7.4 - https://znc.in]
kitallis has joined #ruby
DTZUZO has quit [Ping timeout: 268 seconds]
banisterfiend has joined #ruby
darris has joined #ruby
cyclonis_ has quit [Ping timeout: 276 seconds]
Technodrome has joined #ruby
ellcs has joined #ruby
lalitmee has quit [Remote host closed the connection]
Fernando-Basso has quit [Remote host closed the connection]
lalitmee has joined #ruby
banisterfiend has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gell5 has joined #ruby
carloss has joined #ruby
gell5 has quit [Ping timeout: 244 seconds]
carloss has left #ruby ["Leaving"]
salinasc has joined #ruby
ravenou__ has joined #ruby
ravenous_ has quit [Ping timeout: 252 seconds]
salinasc has quit [Client Quit]
carloss has joined #ruby
carloss has quit [Read error: Connection reset by peer]
salinasc has joined #ruby
tdy has quit [Ping timeout: 244 seconds]
DaRock has quit [Ping timeout: 244 seconds]
dionysus69 has quit [Ping timeout: 245 seconds]
gell5 has joined #ruby
gell5 has quit [Ping timeout: 246 seconds]
shortCircuit__ has joined #ruby
chalkmonster has quit [Quit: WeeChat 2.5]
schneider has joined #ruby
shortCircuit__ has quit [Ping timeout: 245 seconds]
lalitmee has quit [Remote host closed the connection]
Inline has joined #ruby
Inline has quit [Quit: Leaving]
gell5 has joined #ruby
Inline has joined #ruby
salinasc has quit [Ping timeout: 245 seconds]
gell5 has quit [Ping timeout: 245 seconds]
conta has quit [Quit: conta]
za1b1tsu has quit [Read error: Connection reset by peer]
ravenous_ has joined #ruby
ravenou__ has quit [Ping timeout: 264 seconds]
za1b1tsu has joined #ruby
ravenou__ has joined #ruby
^amra has joined #ruby
poontangmessiah has quit [Remote host closed the connection]
<^amra> Hello, how can I split a Hash to two hashes in half?
<^amra> For example I have two key value pairs in my Hash
<havenwood> ^amra: Show an example of what you have and what you want?
<^amra> And I try to create h_1 with first key value pair, and h_2 width second
<havenwood> ^amra: Show an example of the data?
ravenous_ has quit [Ping timeout: 252 seconds]
<havenwood> ^amra: Like, I have `[{aim: true, nope: false}]` and I want `[{aim: true}, {nope: false}]`, for example.
<^amra> HASH = {:a1=>{b1: "1"}, :a2=>{b2: "2"}}, and I want two hashes h_1 = {:a1=>{b1: "1"}}, and h_2 = {:a2=>{b2: "2"}}
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<^amra> I can split by key name or value name, but I need to split in half. first and (second or last)
<^amra> in two parts
nerdius has quit [Read error: Connection reset by peer]
drnerdius has joined #ruby
<havenwood> ^amra: Here's one way:
<havenwood> >> h1, h2 = {:a1=>{b1: "1"}, :a2=>{b2: "2"}}.map(&:then).map(&:to_h)
<ruby[bot]> havenwood: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
<havenwood> h1 #=> {:a1=>{:b1=>"1"}}
<^amra> It's not working
<^amra> Still two pairs in hash
<havenwood> ^amra: I used parallel assignment.
<^amra> hm
<havenwood> ^amra: Run this in your irb: h1, h2 = {:a1=>{b1: "1"}, :a2=>{b2: "2"}}.map(&:then).map(&:to_h)
<havenwood> ^amra: then try `h1` and `h2`
<havenwood> ^amra: See, it works!
<^amra> hm
<^amra> no it's not
<^amra> h1 = hash
<havenwood> ^amra: ?
greengriminal has quit [Quit: This computer has gone to sleep]
<^amra> h2 = nil
<havenwood> h2 #=> {:a2=>{:b2=>"2"}}
<^amra> h1 = {:a1=>{b1: "1"}, :a2=>{b2: "2"}}, and h2 = nil in your example
<^amra> no
<havenwood> ^amra: Are you using Ruby 2.6 and running this code?
<havenwood> h1, h2 = {:a1=>{b1: "1"}, :a2=>{b2: "2"}}.map(&:then).map(&:to_h)
<^amra> hmmm
<havenwood> ^amra: Because h2 isn't nil!
<^amra> yes it's worked now
<^amra> Is there a simpler way?
<havenwood> ^amra: I'm sure there is. Can you show this in context?
greengriminal has joined #ruby
greengriminal has quit [Client Quit]
<^amra> Ok thanks!
<^amra> I think there is some hash = hash.slice(hash.first) or something else
<^amra> but I was wrong
<^amra> thanks!
<havenwood> ^amra: This is an odd use for a Hash. There's certainly a more elegant way to do it. We can help if you're able to show the surrounding code.
<^amra> the code is simple
<^amra> {:a1=>{b1: "1"}, :a2=>{b2: "2"}}
<^amra> That's all
<havenwood> ^amra: Where'd that come from? Did you write that?
<al2o3-cr> ^amra: h1, h2 = h.keys.map { |k| h.slice(k) }
ellcs has quit [Ping timeout: 264 seconds]
<havenwood> h1 = h.first.then.to_h
<^amra> Thanks
<havenwood> There's lots of ways, but I question whether this hash is appropriate for your data in the first place.
<havenwood> (It's not.)
<havenwood> ^amra: Think about other ways to structure the data that's more appropriate for your use.
<^amra> h1 = h.first.then.to_h - That's it! IDEAL
<^amra> Thanks
<havenwood> ¯\_(ツ)_/¯
DTZUZO has joined #ruby
<havenwood> h2 = HASH.drop(1).first.then.to_h
<havenwood> ^amra: I'd change the data rather than write this, but totally up to you!
<havenwood> Or in Rails :P
queip has quit [Ping timeout: 245 seconds]
<havenwood> h2 = HASH.second.then.to_h
<havenwood> I can't remember, is #second Enumerable or just some classes?
<havenwood> Nope, not Enumerable.
dinfuehr has quit [Ping timeout: 245 seconds]
<havenwood> They could just implement it as: lazy.drop(n).first
dinfuehr has joined #ruby
al2o3-cr has quit [Quit: WeeChat 2.5]
Technodrome has joined #ruby
<^amra> - h2 = hash.second.then.to_h
<^amra> not working
<^amra> drop!
<^amra> great
<^amra> yes
<^amra> thanks!
ellcs has joined #ruby
lalitmee has joined #ruby
s2013 has joined #ruby
al2o3-cr has joined #ruby
greengriminal has joined #ruby
queip has joined #ruby
za1b1tsu has quit [Read error: Connection reset by peer]
za1b1tsu has joined #ruby
ellcs has quit [Ping timeout: 245 seconds]
wildtrees has joined #ruby
lalitmee has quit [Remote host closed the connection]
cjkinni has quit [Ping timeout: 268 seconds]
Technodrome has quit [Read error: Connection reset by peer]
dionysus69 has joined #ruby
lalitmee has joined #ruby
^amra has quit [Quit: Leaving]
gell5 has joined #ruby
gell5 has quit [Ping timeout: 245 seconds]
duderono_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rvca has joined #ruby
dinfuehr has quit [Ping timeout: 258 seconds]
rvca has quit [Client Quit]
rvca has joined #ruby
dinfuehr has joined #ruby
orbyt_ has joined #ruby
r29v has joined #ruby
gell5 has joined #ruby
unreal has quit [Read error: Connection reset by peer]
orbyt_ has quit [Quit: Textual IRC Client: www.textualapp.com]
za1b1tsu has quit [Remote host closed the connection]
gell5 has quit [Ping timeout: 246 seconds]
r29v has quit [Quit: r29v]
rvca has quit [Ping timeout: 264 seconds]
dionysus69 has quit [Read error: Connection reset by peer]
hiroaki has joined #ruby
cagomez has joined #ruby
lalitmee has quit [Remote host closed the connection]
greypack has quit [Quit: All your IRC are belong to ZNC]
shortCircuit__ has joined #ruby
greypack has joined #ruby
shortCircuit__ has quit [Ping timeout: 245 seconds]
ravenou__ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
leftylink has quit [Quit: Lost terminal]
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
s2013 has joined #ruby
leftylink has joined #ruby
cagomez has quit [Remote host closed the connection]
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
s2013 has joined #ruby
lnh^ has quit []
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
abaiste^ has joined #ruby
wget has quit [Ping timeout: 246 seconds]
tdy has joined #ruby
gell5 has joined #ruby
henninb has joined #ruby
SeepingN has joined #ruby
gell5 has quit [Ping timeout: 244 seconds]
banisterfiend has joined #ruby
psilly0 has joined #ruby
Guest15733 has quit [Ping timeout: 244 seconds]
aphprentice__ has joined #ruby
DaRock has joined #ruby
psilly0 has quit [Quit: psilly0]
john2496 has joined #ruby
john2496 has quit [Remote host closed the connection]
john2496 has joined #ruby
duderonomy has joined #ruby
psilly0 has joined #ruby
banisterfiend has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Guest15733 has joined #ruby
poontangmessiah has joined #ruby
snuz has joined #ruby
psilly0 has quit [Quit: psilly0]
john2496 has quit [Read error: Connection reset by peer]
sameerynho has quit [Ping timeout: 245 seconds]
Fr4n has quit [Quit: Fr4n]
banisterfiend has joined #ruby
psilly0 has joined #ruby
henninb has quit [Quit: Lost terminal]
Guest15733 has quit [Ping timeout: 245 seconds]
RiPuk has quit [Remote host closed the connection]
RiPuk has joined #ruby
gell5 has joined #ruby
tdy has quit [Ping timeout: 244 seconds]
gell5 has quit [Ping timeout: 246 seconds]
Intelo has quit [Ping timeout: 246 seconds]
queip has quit [Ping timeout: 245 seconds]
queip has joined #ruby
x86sk has joined #ruby
wildtrees has quit [Quit: Leaving]
john2496 has joined #ruby
john2496 has quit [Read error: Connection reset by peer]
john2496 has joined #ruby
Nicmavr has quit [Read error: Connection reset by peer]
Nicmavr has joined #ruby
john2496 has quit [Read error: Connection reset by peer]
john2496_ has joined #ruby
lucasb has quit [Quit: Connection closed for inactivity]
wymillerlinux has joined #ruby
ellcs has joined #ruby
wymillerlinux has quit [Ping timeout: 245 seconds]
wymillerlinux has joined #ruby
john2496_ has quit [Ping timeout: 245 seconds]