havenwood changed the topic of #ruby to: Rules & more: https://ruby-community.com | Ruby 2.7.1, 2.6.6, 2.5.8: 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!
SeepingN has joined #ruby
Garb0 has joined #ruby
NightMonkey has quit [Quit: ZNC - http://znc.in]
fluxAeon has joined #ruby
NightMonkey has joined #ruby
impermanence has quit [Quit: Connection closed]
tty1_ has quit [Ping timeout: 240 seconds]
ur5us has joined #ruby
<howdoi> got it, ignore
solars has quit [Quit: Connection closed for inactivity]
gzc has quit [Ping timeout: 240 seconds]
sticaz has quit [Ping timeout: 246 seconds]
sticaz has joined #ruby
gzc has joined #ruby
xco has joined #ruby
gix has quit [Ping timeout: 260 seconds]
oneeggeach has joined #ruby
xco has quit [Quit: Textual IRC Client: www.textualapp.com]
pwnd_nsfw has quit [Ping timeout: 240 seconds]
akem has quit [Remote host closed the connection]
akem has joined #ruby
cnsvc has quit [Remote host closed the connection]
cnsvc has joined #ruby
chalkmonster has joined #ruby
jinmiaoluo has joined #ruby
Tempesta has quit [Quit: See ya!]
ldepandis has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cnsvc has quit [Ping timeout: 240 seconds]
mikecmpbll has quit [Ping timeout: 260 seconds]
Tempesta has joined #ruby
mikecmpbll has joined #ruby
jinmiaoluo has quit [Ping timeout: 244 seconds]
jinmiaoluo has joined #ruby
oneeggeach has quit [Quit: Leaving...]
sergioro has quit [Ping timeout: 246 seconds]
sergioro has joined #ruby
imode has joined #ruby
Garb0 has quit [Read error: Connection reset by peer]
Garb0 has joined #ruby
ChmEarl has quit [Quit: Leaving]
kinduff has quit [Read error: Connection reset by peer]
kinduff has joined #ruby
fluxAeon has quit [Quit: Textual IRC Client: www.textualapp.com]
titanbiscuit has quit [Quit: ZNC 1.7.5 - https://znc.in]
titanbiscuit has joined #ruby
dhollinger has quit [Ping timeout: 260 seconds]
dhollinger has joined #ruby
Ai9zO5AP has quit [Remote host closed the connection]
dhollinger has quit [Ping timeout: 260 seconds]
Garb0 has quit [Read error: Connection reset by peer]
dhollinger has joined #ruby
s2013 has quit [Quit: Textual IRC Client: www.textualapp.com]
diegospb has joined #ruby
titanbiscuit has quit [Ping timeout: 260 seconds]
titanbiscuit has joined #ruby
dhollinger has quit [Ping timeout: 260 seconds]
dhollinger has joined #ruby
buckworst has joined #ruby
buckworst has quit [Client Quit]
buckworst has joined #ruby
buckworst has quit [Client Quit]
diegospb has quit [Remote host closed the connection]
roadie has joined #ruby
bwitt has left #ruby ["Leaving"]
mikecmpbll has quit [Ping timeout: 260 seconds]
mikecmpbll has joined #ruby
SeepingN has quit [Read error: Connection reset by peer]
SeepingN has joined #ruby
braj has joined #ruby
cthu| has quit [Ping timeout: 260 seconds]
roadie has quit [Ping timeout: 244 seconds]
Garb0 has joined #ruby
jinie has quit [Quit: ZNC 1.6.1 - http://znc.in]
jinie has joined #ruby
tpanarch1st has quit [Ping timeout: 240 seconds]
cd has quit [Quit: cd]
ur5us has quit [Ping timeout: 240 seconds]
imode has quit [Ping timeout: 244 seconds]
yxhuvud has quit [Read error: Connection reset by peer]
yxhuvud has joined #ruby
alfiemax has joined #ruby
al2o3-cr has quit [Quit: WeeChat 2.8]
al2o3-cr has joined #ruby
buckworst has joined #ruby
alfiemax has quit [Ping timeout: 260 seconds]
chalkmonster has quit [Quit: WeeChat 2.8]
mozzarella has quit [Remote host closed the connection]
buckworst has quit [Client Quit]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
mozzarella has joined #ruby
conta has joined #ruby
mikecmpbll has quit [Ping timeout: 246 seconds]
chalkmonster has joined #ruby
mikecmpbll has joined #ruby
nowhere_man has quit [Ping timeout: 265 seconds]
baweaver has quit [Excess Flood]
ldepandis has joined #ruby
baweaver has joined #ruby
Esa__ has quit [Remote host closed the connection]
vqrs_ has quit [Ping timeout: 265 seconds]
vqrs has joined #ruby
jmcgnh has quit [Ping timeout: 260 seconds]
schne1der has joined #ruby
jmcgnh has joined #ruby
chalkmonster has quit [Quit: WeeChat 2.8]
alexherbo2 has joined #ruby
vqrs has quit [Ping timeout: 240 seconds]
vqrs has joined #ruby
sergushakov has quit [Quit: WeeChat 2.3]
mozzarella has quit [Remote host closed the connection]
braj has quit []
mozzarella has joined #ruby
mozzarella has joined #ruby
mozzarella has quit [Remote host closed the connection]
mozzarella has joined #ruby
Garb0 has quit [Quit: Leaving]
ericm has quit [Ping timeout: 240 seconds]
al2o3-cr has quit [Quit: WeeChat 2.8]
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
al2o3-cr has joined #ruby
chalkmonster has joined #ruby
TomyWork has joined #ruby
alexherbo23 has joined #ruby
markopasha has joined #ruby
markopasha has quit [Read error: Connection reset by peer]
alexherbo2 has quit [Ping timeout: 246 seconds]
alexherbo23 is now known as alexherbo2
hassox has joined #ruby
hassox has quit [Ping timeout: 260 seconds]
braj has joined #ruby
braj has quit [Client Quit]
alfiemax has joined #ruby
alfiemax has quit [Remote host closed the connection]
alfiemax has joined #ruby
kinduff has quit [Read error: Connection reset by peer]
kinduff has joined #ruby
<sagax> how to make this better https://susepaste.org/41106383 ?
<sagax> ruby 2.2.1
chouhoulis has quit [Remote host closed the connection]
akem has quit [Quit: Leaving]
akem has joined #ruby
<sagax> do this, but maybe it's not better https://susepaste.org/38161529
burgestrand has joined #ruby
burgestrand has quit [Client Quit]
Fusl has quit [Excess Flood]
Fusl has joined #ruby
alfiemax has quit [Ping timeout: 260 seconds]
sergushakov has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
arcaos has quit [Remote host closed the connection]
alfiemax has joined #ruby
alexherbo27 has joined #ruby
alexherbo2 has quit [Ping timeout: 244 seconds]
alexherbo27 is now known as alexherbo2
dionysus69 has joined #ruby
alfiemax has quit [Ping timeout: 260 seconds]
<phaul> &>> {a: 1, b: 2, c: 3}.select { |k| [:a, :c].include? k } # sagax
<rubydoc> # => {:a=>1, :c=>3} (https://carc.in/#/r/8yzo)
<phaul> this keeps the original hash
<sagax> not bad, not bad, but select can't make default value as `nil`
<sagax> `select` understand only `true` or `false`
<phaul> I missed that bit from the requirements.
<phaul> depending on how you use it it could be ok though
<phaul> &>> {}[:a]
<rubydoc> # => nil (https://carc.in/#/r/8yzp)
fercell has joined #ruby
jinmiaoluo has quit [Ping timeout: 264 seconds]
<sagax> `requirements` it's native? because in ruby 2.2.1 have not `requirements`
SeepingN has quit [Ping timeout: 246 seconds]
ur5us has joined #ruby
SeepingN has joined #ruby
ldepandis has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dhollinger has quit [Ping timeout: 260 seconds]
dhollinger has joined #ruby
jinmiaoluo has joined #ruby
aef has quit [Ping timeout: 256 seconds]
Other has quit [Remote host closed the connection]
bvdw1 has joined #ruby
ritalinona has joined #ruby
ujjain has quit [Ping timeout: 264 seconds]
apoc has quit [Ping timeout: 256 seconds]
lurkless has quit [Ping timeout: 256 seconds]
bvdw has quit [Ping timeout: 256 seconds]
bvdw1 is now known as bvdw
aef has joined #ruby
lurkless has joined #ruby
apoc has joined #ruby
lxsameer has joined #ruby
ujjain has joined #ruby
momozor has joined #ruby
<momozor> Hi guys
<momozor> How do you preserve type informations? Do you put it in the source code comment?
<momozor> Or rather, just look at unit test for how certain function/methoc/whatever is being used?
<momozor> and guess the passed type information from the unit tests
ldepandis has joined #ruby
TCZ has joined #ruby
momozor has quit [Quit: Lost terminal]
jinmiaol2 has joined #ruby
jinmiaol2 has quit [Remote host closed the connection]
jinmiaol2 has joined #ruby
jinmiaoluo has quit [Ping timeout: 240 seconds]
ur5us has quit [Ping timeout: 244 seconds]
troulouliou_dev has joined #ruby
tty1_ has joined #ruby
vondruch_ has joined #ruby
stooj has quit [Quit: ZNC 1.7.5 - https://znc.in]
x0f_ has joined #ruby
x0f has quit [Ping timeout: 260 seconds]
Technodrome has joined #ruby
vondruch has quit [Ping timeout: 258 seconds]
vondruch_ is now known as vondruch
Ai9zO5AP has joined #ruby
d3bug has quit [Quit: Connection closed for inactivity]
stooj has joined #ruby
wilhelm418 has joined #ruby
drincruz has joined #ruby
conta has quit [Quit: conta]
dionysus69 has quit [Remote host closed the connection]
dionysus69 has joined #ruby
burningserenity has joined #ruby
drincruz has quit [Ping timeout: 260 seconds]
chalkmonster has quit [Quit: WeeChat 2.8]
jinmiaol2 has quit [Ping timeout: 265 seconds]
drincruz has joined #ruby
jinmiaol2 has joined #ruby
xco has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
Esa__ has joined #ruby
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jinmiaol2 has quit [Ping timeout: 260 seconds]
jinmiaol2 has joined #ruby
sergioro has quit [Quit: Lost terminal]
buckworst has joined #ruby
jcalla has joined #ruby
buckworst has quit [Client Quit]
buckworst has joined #ruby
chalkmonster has joined #ruby
buckworst has quit [Quit: WeeChat 2.8]
sh7d has quit [Quit: meh]
sh7d has joined #ruby
TCZ has quit [Quit: Leaving]
stooj has quit [Quit: ZNC 1.7.5 - https://znc.in]
GodFather has joined #ruby
drincruz has quit [Read error: Connection reset by peer]
drincruz has joined #ruby
drincruz_ has joined #ruby
drincruz has quit [Ping timeout: 240 seconds]
GodFather has quit [Ping timeout: 260 seconds]
crisfm has quit [Quit: WeeChat 2.7.1]
rmnull has joined #ruby
GodFather has joined #ruby
brool has joined #ruby
TCZ has joined #ruby
SeepingN has quit [Read error: Connection reset by peer]
SeepingN has joined #ruby
alexherbo29 has joined #ruby
alexherbo2 has quit [Ping timeout: 246 seconds]
alexherbo29 is now known as alexherbo2
howdoi has quit [Quit: Connection closed for inactivity]
impermanence has joined #ruby
impermanence has quit [Client Quit]
alexherbo27 has joined #ruby
alexherbo2 has quit [Ping timeout: 260 seconds]
alexherbo27 is now known as alexherbo2
rippa has joined #ruby
alexherbo2 has quit [Quit: The Lounge - https://thelounge.chat]
conta has joined #ruby
jinmiaol2 has quit [Ping timeout: 246 seconds]
jinmiaol2 has joined #ruby
conta has quit [Quit: conta]
ChmEarl has joined #ruby
cd has joined #ruby
TatteredGusset has joined #ruby
cd has quit [Client Quit]
chalkmonster has quit [Quit: WeeChat 2.8]
chalkmonster has joined #ruby
DTZUZU has quit [Ping timeout: 260 seconds]
DTZUZU2 has joined #ruby
cd has joined #ruby
<adam12> Anybody remember which issue the argument delegation feature was discussed in? (`...`). It's impossible to search for.
<adam12> Nevermind. Found it through Benoit's blog post on it. https://bugs.ruby-lang.org/issues/16253
chalkmonster has quit [Quit: WeeChat 2.8]
felix_221986 has joined #ruby
sergioro has joined #ruby
jinie has quit [Quit: ZNC 1.6.1 - http://znc.in]
TCZ has quit [Quit: Leaving]
jinie has joined #ruby
TCZ has joined #ruby
TCZ has quit [Remote host closed the connection]
fercell has quit [Quit: WeeChat 2.8]
DTZUZU2 has quit [Quit: WeeChat 2.7]
DTZUZU has joined #ruby
<TatteredGusset> Hi all, apologies for the ‘Eternal September’ type message. Please just tell me if this is not the right sort of post for this channel and I won’t ask again.
<TatteredGusset> I’m learning Ruby from Chris Pine’s ‘Learn to Program’ and loving it. The first time I have found a book on its own to be the best way to learn anything.
<TatteredGusset> I had a question. There is the ubiquitous ‘make a word sorter without using sort’ exercise. When taking potential capitalization into account, my thought is to take the word-list and make a hash like so recording which word had a capital letter. Then at the end we use .capitalize() on the words with ‘true’.
<TatteredGusset> {{:word=>"apple", :cap=>true }, {:word=>"zebra", :cap=>true}, {:word=>"puffin", :cap=>false}}
<TatteredGusset> Which type of Hash would be most suitable assuming no duplicates and why?
<TatteredGusset> Or
<TatteredGusset> {:apple => true, :zebra => false, :puffin => true}
<TatteredGusset> {{:word => "apple", :cap => true, :ascii-96 => 1}, {:word =>"zebra", :cap =>true, :ascii_min_96 => 26}, {:word => "puffin", :cap => false, :ascii_min_96 => 16}}
<TatteredGusset> If I were to add another object associated with each word. Would you do
<TatteredGusset> Or
<TatteredGusset> {:apple => {:cap => true, :ascii-96 => 1}, :zebra => {:cap => true, :ascii_min_96 => 26} , :puffin => {:cap => false, :ascii_min_96 => 16}}
<TatteredGusset> Many thanks for any advice or pointers!
felix_221986 has quit [Quit: Connection closed]
<adam12> TatteredGusset: Calling capitalize would likely fail on something like `McDonalds`, so I think that's an edge case.
cthu| has joined #ruby
<adam12> TatteredGusset: You could always make your own object and store things on it. Ie. It could be a Word object that has a downcased version of the word, the original word, and maybe something else? Use the downcased version of the word for comparison and keep the original around for presentation.
bodgix has quit [Quit: ZNC 1.7.2 - https://znc.in]
<adam12> TatteredGusset: There's nothing wrong with using Hash's here but sometimes it's referred to as primitive obsession. Don't be afraid to use your own types of objects or wrap existing objects.
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bodgix_ has joined #ruby
<adam12> TatteredGusset: If you end up making your own class, you'll likely want to look at the Rocketship operator and Comparable module.
daemonwrangler has quit [Quit: ZNC 1.6.5 - http://znc.in]
* havenwood flies off in a <=>
ellcs has joined #ruby
daemonwrangler has joined #ruby
<TatteredGusset> adam12 Ah yes the McD example is so true. Thanks for pointing that out. I am just reading about Primitive Obsession, it wasn't a concept I had come across before.
daemonwrangler has quit [Client Quit]
daemonwrangler has joined #ruby
BH23 has quit [Remote host closed the connection]
BH23 has joined #ruby
ldepandis has quit [Quit: Textual IRC Client: www.textualapp.com]
jinmiaol2 has quit [Read error: Connection reset by peer]
DTZUZU has quit [Ping timeout: 246 seconds]
DTZUZU2 has joined #ruby
jinmiaol2 has joined #ruby
CrazyEddy has quit [Ping timeout: 260 seconds]
mikecmpbll has quit [Ping timeout: 260 seconds]
jinmiaol2 has quit [Ping timeout: 260 seconds]
mikecmpbll has joined #ruby
<apotheon> TatteredGusset: I would definitely go with comparing downcased strings, but you then have to double-check when you have two strings that are different as entered but identical when downcased, so make sure you account for that.
<apotheon> TatteredGusset: (re: what adam12 said)
jinmiaol2 has joined #ruby
<apotheon> adam12: What do you mean "Rocketship operator"? I mean, there's the "hash rocket", and there's the "spaceship operator". I don't think I've encountered a reference to any "rocketship operator".
<apotheon> adam12: If you mean a spaceship operator, I think just using that directly is tantamount to using a sort method, so it would probably undermine the intention of the exercise.
<adam12> apotheon: I meant the spaceship operator. It was pre-lunch ;)
<apotheon> Ah, okay. Thanks for clarifying.
dviola has quit [Quit: WeeChat 2.8]
<apotheon> I guess I don't know for sure whether using the spaceship operator violates the spirit of the exercise, though, because I haven't read Chris Pine's book.
<adam12> apotheon: Possibly. I hadn't seen the exercise intention.
<adam12> Or rather, seen the exercise to determine the intention.
<apotheon> I think I skimmed the tutorial on which the book was based before there was a book, but I don't recall much about it except that, to me, it didn't feel like a significant enough introduction to the language.
<apotheon> . . . then the author went on to play a young James T. Kirk! Wait, no, that's the wrong Chris Pine.
<adam12> It's interesting that there's hash "rocket" (=>) but "spaceship" operator (<=>). I kinda like my naming as "rocketship" operator more.
<apotheon> the spaceship operator looks to me more like a flying saucer, and the hash rocket has more of a rocket-y look to it.
<apotheon> s/^the/The/
<adam12> We're in whiteboard programming territory right now. "Sort this list of values". "OK". values.sort.
<apotheon> "Now implement quicksort or bubble sort."
<apotheon> Now that I think about it, given the likely target audience of Chris Pine's book, maybe using the spaceship operator really *is* what was intended. I really don't know.
<apotheon> I mean, if this was in Perl 5 and it said don't use something built in, it would pretty much *have to* mean "Don't use the spaceship operator."
<apotheon> Using the spaceship operator was *the* way to sort things in Perl.
<apotheon> If the book demands writing a sorting algorithm directly, though, I think bubble sort would probably be the most straightforward way to write it, even if not the most efficient.
SeepingN has quit [Quit: The system is going down for reboot NOW!]
wilhelm418 has quit [Ping timeout: 240 seconds]
alfiemax has joined #ruby
SeepingN has joined #ruby
alfiemax_ has joined #ruby
<TatteredGusset> apotheon this is my first amateurish draft of the bubble search. I am amending it now to be better written https://gist.github.com/Ollie-Boyd/023b86c3461436f1418aa24ba4ba55a3
<TatteredGusset> thanks for your points
<apotheon> I hope they help.
<TatteredGusset> to be fair to Chris's book, my father is pushing 80 and I thought he could probably learn from it :)
alfiemax has quit [Ping timeout: 265 seconds]
Technodrome has joined #ruby
alfiemax_ has quit [Remote host closed the connection]
<apotheon> cool
impermanence has joined #ruby
braj has joined #ruby
d3bug has joined #ruby
SeepingN has quit [Read error: Connection reset by peer]
SeepingN has joined #ruby
sticaz has quit [Quit: WeeChat 2.8]
kinduff has quit [Quit: gg]
kinduff has joined #ruby
chouhoulis has joined #ruby
gix has joined #ruby
r3m has quit [Quit: WeeChat 2.9-dev]
r3m has joined #ruby
arcaos has joined #ruby
finchfiler has joined #ruby
braj has quit []
imode has joined #ruby
jinmiaol2 has quit [Ping timeout: 264 seconds]
davispuh has joined #ruby
sauvin has quit [Read error: Connection reset by peer]
Xiti` has joined #ruby
Xiti has quit [Ping timeout: 260 seconds]
rickhull has joined #ruby
Xiti has joined #ruby
rmnull has quit [Read error: Connection reset by peer]
stooj has joined #ruby
Xiti` has quit [Ping timeout: 260 seconds]
rickhull has joined #ruby
rickhull has quit [Changing host]
alfiemax has joined #ruby
mikecmpbll has quit [Ping timeout: 246 seconds]
imode has quit [Ping timeout: 272 seconds]
mikecmpbll has joined #ruby
tpanarch1st has joined #ruby
vondruch_ has joined #ruby
vondruch has quit [Ping timeout: 246 seconds]
vondruch_ is now known as vondruch
TCZ has joined #ruby
diegospb has joined #ruby
burningserenity has quit [Remote host closed the connection]
tankf33der has quit [Quit: Connection closed for inactivity]
ellcs has quit [Ping timeout: 244 seconds]
caterfxo has quit [Ping timeout: 260 seconds]
caterfxo has joined #ruby
jcalla has quit [Remote host closed the connection]
diegospb has quit [Remote host closed the connection]
CrazyEddy has joined #ruby
dhollinger has quit [Ping timeout: 260 seconds]
dhollinger has joined #ruby
jeromelanteri has quit [Quit: Leaving]
caterfxo has quit [Ping timeout: 260 seconds]
TatteredGusset has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
caterfxo has joined #ruby
ur5us has joined #ruby
mikecmpbll has quit [Ping timeout: 260 seconds]
dionysus69 has quit [Ping timeout: 258 seconds]
caterfxo has quit [Ping timeout: 244 seconds]
mikecmpbll has joined #ruby
caterfxo has joined #ruby
dionysus69 has joined #ruby
Esa__ has quit []
tty1_ has quit [Ping timeout: 260 seconds]
jetchisel has quit [Quit: Unfortunately time is always against us -- [Morpheus]]
troulouliou_dev has quit [Quit: Leaving]
jetchisel has joined #ruby
shokohsc8 has joined #ruby
shokohsc has quit [Ping timeout: 265 seconds]
xco has joined #ruby
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
r3m has quit [Quit: WeeChat 2.9-dev]
r3m has joined #ruby
TCZ has quit [Quit: Leaving]
schne1der has quit [Ping timeout: 260 seconds]
DTZUZU2 has quit [Ping timeout: 246 seconds]
DTZUZU2 has joined #ruby
hiroaki has quit [Ping timeout: 260 seconds]
Garb0 has joined #ruby
hiroaki has joined #ruby
lalitmee has joined #ruby
hiroaki has quit [Ping timeout: 264 seconds]
imode has joined #ruby
sergushakov has quit [Quit: WeeChat 2.3]
drincruz_ has quit [Ping timeout: 260 seconds]
lalitmee has quit [Remote host closed the connection]
Xiti has quit [Ping timeout: 244 seconds]
asuper has joined #ruby
impermanence has quit [Quit: Connection closed]
buckworst has joined #ruby
lalitmee has joined #ruby
Xiti has joined #ruby
asuper has quit [Client Quit]
asuper has joined #ruby
caterfxo has quit [Ping timeout: 260 seconds]
caterfxo has joined #ruby
lalitmee has quit [Remote host closed the connection]
finchfiler has quit [Quit: Connection closed]
brool has quit [Read error: Connection reset by peer]
arahael2 has quit [Ping timeout: 260 seconds]
arahael2 has joined #ruby