havenwood changed the topic of #ruby to: Rules & more: https://ruby-community.com | Ruby 2.7.0, 2.6.5, 2.5.7: 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!
GeissT has joined #ruby
jmcgnh has quit [Quit: ZNC 1.7.5 - https://znc.in]
jmcgnh has joined #ruby
Arkantos has joined #ruby
donofrio has joined #ruby
donofrio has quit [Remote host closed the connection]
donofrio has joined #ruby
gigetoo has joined #ruby
donofrio has quit [Remote host closed the connection]
donofrio has joined #ruby
cschneid has quit [Ping timeout: 256 seconds]
cschneid_ has joined #ruby
ur5us has joined #ruby
roadie has joined #ruby
Arkantos has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cschneid_ has quit [Quit: ZNC 1.7.5 - https://znc.in]
cschneid has joined #ruby
roadie has quit [Ping timeout: 256 seconds]
GeissT has quit [Ping timeout: 256 seconds]
dasher00 has quit [Ping timeout: 256 seconds]
cschneid has quit [Read error: Connection reset by peer]
jtdowney has quit [Quit: Bye]
Arkantos has joined #ruby
jtdowney has joined #ruby
SeepingN has quit [Quit: The system is going down for reboot NOW!]
jtdowney has quit [Client Quit]
cschneid has joined #ruby
davispuh has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
jtdowney has joined #ruby
MadLamb has quit [Ping timeout: 256 seconds]
sergioro has quit [Quit: Lost terminal]
brool has joined #ruby
jtdowney has quit [Quit: Bye]
Arkantos has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<brool> is it a bad idea to use File.open() in a sinatra app? i made a hangman game and File.open() just loads the word bank and picks one for the session
<brool> i'm assuming it's a bad idea but i don't know why
<brool> even though it works ¯\_(ツ)_/¯
<adam12> brool: Seems OK to me. I might not open files in a hot path for an app that's doing 1000's of requests per second, but for your hangman app I don't see an issue.
<brool> ok
Arkantos has joined #ruby
<adam12> brool: I'd probably make sure you're closing the files tho. Either use File.read or File.open with a block. Or make sure you call #close on the file object. Something.
<brool> i have File.open().read_lines.to_a
<brool> s/read_lines/each_line
roadie has joined #ruby
ritalinona has quit [Remote host closed the connection]
ritalinona has joined #ruby
<adam12> brool: File.readlines("filename")
<brool> ooh
<adam12> brool: Unless the file is huge.
<adam12> I'm out. Good luck.
<brool> it's only a few hundred lines, 8.6kb
<brool> basically "keyword,hint" on each line
<al2o3-cr> brool: just for good measure add chomp: true to readlines.
<brool> ok
roadie has quit [Ping timeout: 240 seconds]
brool has quit [Ping timeout: 252 seconds]
brendan- has quit [Ping timeout: 252 seconds]
brendan- has joined #ruby
sergioro has joined #ruby
LDonoughe has joined #ruby
al2o3-cr has quit [Quit: WeeChat 2.7.1]
brendan- has quit [Ping timeout: 250 seconds]
al2o3-cr has joined #ruby
gix has quit [Ping timeout: 265 seconds]
Arkantos has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ChmEarl has quit [Quit: Leaving]
roadie has joined #ruby
roadie has quit [Ping timeout: 256 seconds]
LDonoughe has quit [Ping timeout: 256 seconds]
jmcgnh has quit [Read error: Connection reset by peer]
jmcgnh has joined #ruby
jtdowney has joined #ruby
jmcgnh has quit [Remote host closed the connection]
alfiemax has joined #ruby
jtdowney has quit [Client Quit]
jtdowney has joined #ruby
cschneid_ has joined #ruby
cschneid has quit [Ping timeout: 256 seconds]
jtdowney has quit [Client Quit]
jtdowney has joined #ruby
jtdowney has quit [Quit: Bye]
jtdowney has joined #ruby
jtdowney has quit [Remote host closed the connection]
braincrash has quit [Quit: bye bye]
jtdowney has joined #ruby
code_zombie has quit [Quit: Leaving]
braincrash has joined #ruby
LDonoughe has joined #ruby
jtdowney has quit [Quit: Bye]
jtdowney has joined #ruby
jtdowney has quit [Remote host closed the connection]
LDonoughe has quit [Ping timeout: 256 seconds]
jtdowney has joined #ruby
alfiemax has quit [Ping timeout: 246 seconds]
kinduff has quit [Read error: Connection reset by peer]
kinduff has joined #ruby
jmcgnh has joined #ruby
brendan- has joined #ruby
brool has joined #ruby
brool has quit [Client Quit]
wmoxam_ is now known as wmoxam
wmoxam has quit [Changing host]
wmoxam has joined #ruby
LDonoughe has joined #ruby
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
LDonoughe has quit [Ping timeout: 240 seconds]
cd has quit [Quit: cd]
KeyJoo has quit [Quit: KeyJoo]
duderonomy has quit [Ping timeout: 264 seconds]
duderonomy has joined #ruby
akem has quit [Quit: Leaving]
ur5us has quit [Ping timeout: 252 seconds]
jingjinghack has joined #ruby
sergioro has quit [Quit: leaving]
alfiemax has joined #ruby
factormystic7 has joined #ruby
sergioro has joined #ruby
factormystic has quit [Ping timeout: 256 seconds]
factormystic7 is now known as factormystic
cthu| has joined #ruby
ritalinona has quit [Ping timeout: 240 seconds]
iNs has quit [Remote host closed the connection]
lineus has quit [Remote host closed the connection]
galaxie has quit [Write error: Connection reset by peer]
iNs has joined #ruby
ritalinona has joined #ruby
jmcgnh has quit [Read error: Connection reset by peer]
lineus has joined #ruby
galaxie has joined #ruby
sergioro has quit [Quit: leaving]
jmcgnh has joined #ruby
cschneid has joined #ruby
cschneid_ has quit [Ping timeout: 256 seconds]
pandakekok9 has joined #ruby
alfiemax has quit [Remote host closed the connection]
roadie has joined #ruby
alfiemax has joined #ruby
LDonoughe has joined #ruby
sergioro has joined #ruby
LDonoughe has quit [Ping timeout: 264 seconds]
LDonoughe has joined #ruby
jmcgnh has quit [Ping timeout: 252 seconds]
jmcgnh_ has joined #ruby
jmcgnh_ is now known as jmcgnh
bvdw has quit [Read error: Connection reset by peer]
LDonoughe has quit [Ping timeout: 246 seconds]
bvdw has joined #ruby
alfiemax has quit [Ping timeout: 252 seconds]
roadie has quit [Quit: ERC (IRC client for Emacs 25.3.50.1)]
roadie has joined #ruby
Arkantos has joined #ruby
LDonoughe has joined #ruby
dviola has quit [Quit: WeeChat 2.7.1]
LDonoughe has quit [Ping timeout: 265 seconds]
mheld has quit [Quit: Connection closed for inactivity]
markopasha has joined #ruby
cthu| has quit [Ping timeout: 252 seconds]
Arkantos has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
xco has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
xco has quit [Client Quit]
hiroaki has quit [Ping timeout: 258 seconds]
roadie has quit [Remote host closed the connection]
markopasha has quit [Ping timeout: 265 seconds]
jmcgnh has quit [Remote host closed the connection]
conta has joined #ruby
LDonoughe has joined #ruby
xco has joined #ruby
xco has quit [Client Quit]
LDonoughe has quit [Ping timeout: 252 seconds]
cschneid has quit [Ping timeout: 246 seconds]
cschneid has joined #ruby
sergioro has quit [Quit: leaving]
arcaos has joined #ruby
conta has quit [Quit: conta]
arcaos has quit [Read error: Connection reset by peer]
arcaos has joined #ruby
arcaos has quit [Remote host closed the connection]
_phaul has joined #ruby
phaul has quit [Ping timeout: 250 seconds]
pandakekok9 has quit [Ping timeout: 252 seconds]
pandakekok9 has joined #ruby
schne1der has joined #ruby
_phaul has quit [Ping timeout: 260 seconds]
_phaul has joined #ruby
mainfram has joined #ruby
d3bug has quit [Quit: Connection closed for inactivity]
TomyWork has joined #ruby
arekushi has joined #ruby
phaul has joined #ruby
alfiemax has joined #ruby
_phaul has quit [Ping timeout: 264 seconds]
alfiemax has quit [Remote host closed the connection]
phaul has quit [Ping timeout: 256 seconds]
phaul has joined #ruby
gix has joined #ruby
xyhuvud has quit [Read error: Connection reset by peer]
yxhuvud has joined #ruby
alfiemax has joined #ruby
jmcgnh has joined #ruby
ellcs has joined #ruby
ellcs has quit [Ping timeout: 246 seconds]
ur5us has joined #ruby
jingjinghack has quit [Quit: WeeChat 2.1]
cschneid has quit [Quit: ZNC 1.7.5 - https://znc.in]
dionysus69 has joined #ruby
dinfuehr has quit [Ping timeout: 240 seconds]
dinfuehr has joined #ruby
cschneid has joined #ruby
xco has joined #ruby
chalkmonster has joined #ruby
alfiemax has quit [Remote host closed the connection]
sysh has joined #ruby
arcaos has joined #ruby
noboruma has joined #ruby
chalkmonster has quit [Quit: WeeChat 2.7.1]
alfiemax has joined #ruby
vondruch_ has joined #ruby
akem has joined #ruby
vondruch has quit [Ping timeout: 246 seconds]
vondruch_ is now known as vondruch
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ur5us has quit [Ping timeout: 240 seconds]
xco has joined #ruby
mikecmpbll has quit [Ping timeout: 250 seconds]
code_zombie has joined #ruby
ellcs has joined #ruby
roadie has joined #ruby
alfiemax has quit [Remote host closed the connection]
ellcs has quit [Ping timeout: 246 seconds]
cschneid has quit [Ping timeout: 256 seconds]
cschneid has joined #ruby
shansen_ has quit [Quit: ZNC 1.7.4+deb0+bionic0 - https://znc.in]
bvdw has quit [Read error: Connection reset by peer]
bvdw has joined #ruby
drincruz_ has joined #ruby
s2013 has joined #ruby
kinduff has quit [Read error: Connection reset by peer]
kinduff has joined #ruby
chalkmonster has joined #ruby
ctOS has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
Azure has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
conta has joined #ruby
fercell has joined #ruby
millerti has joined #ruby
cow[moo] has joined #ruby
_whitelogger has joined #ruby
hassox has joined #ruby
raj__ is now known as raj
hassox has quit [Ping timeout: 252 seconds]
cschneid has quit [Ping timeout: 264 seconds]
cschneid has joined #ruby
ellcs has joined #ruby
evdubs has joined #ruby
nofxx_ has quit [Remote host closed the connection]
nofxx_ has joined #ruby
pandakekok9 has quit [Quit: popopo]
ctOS has quit [Quit: Connection closed for inactivity]
imadper has joined #ruby
vondruch_ has joined #ruby
vondruch has quit [Ping timeout: 265 seconds]
vondruch_ is now known as vondruch
fercell has quit [Quit: WeeChat 2.7.1]
Arkantos has joined #ruby
cd has joined #ruby
cthu| has joined #ruby
fercell has joined #ruby
conta2 has joined #ruby
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
conta has quit [Ping timeout: 256 seconds]
conta2 is now known as conta
Arkantos has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Exagone313 has quit [Quit: see ya!]
Cork has quit [Remote host closed the connection]
oz has quit [Quit: EOF]
spk has quit [Ping timeout: 252 seconds]
lineus has quit [Ping timeout: 240 seconds]
Chiron has quit [Ping timeout: 256 seconds]
Exagone313 has joined #ruby
xpitr has quit [Ping timeout: 260 seconds]
Furai has quit [Ping timeout: 246 seconds]
bier has quit [Ping timeout: 265 seconds]
oz has joined #ruby
csaunders has quit [Ping timeout: 240 seconds]
NODE has quit [Excess Flood]
tuxayo[m] has quit [Ping timeout: 240 seconds]
GGMethos has quit [Ping timeout: 240 seconds]
Guest84291 has quit [Ping timeout: 260 seconds]
Cork has joined #ruby
LDonoughe has joined #ruby
NODE has joined #ruby
lineus has joined #ruby
spk has joined #ruby
ChmEarl has joined #ruby
d3bug has joined #ruby
oz has quit [Quit: EOF]
spk has quit [Ping timeout: 252 seconds]
oz has joined #ruby
roadie has quit [Ping timeout: 256 seconds]
LtHummus has quit [Quit: ZNC 1.7.5 - https://znc.in]
spk has joined #ruby
cschneid_ has joined #ruby
cschneid has quit [Ping timeout: 240 seconds]
spk has quit [Ping timeout: 260 seconds]
LtHummus has joined #ruby
Emmanuel_Chanel has quit [Ping timeout: 260 seconds]
spk has joined #ruby
gremax has quit [Ping timeout: 260 seconds]
NODE has quit [Quit: changing servers]
mbarbar has quit [*.net *.split]
darthThorik has quit [*.net *.split]
matti has quit [*.net *.split]
wbnns has quit [*.net *.split]
hahuang65 has quit [*.net *.split]
entel has quit [*.net *.split]
badeball has quit [*.net *.split]
kevinsjoberg has quit [*.net *.split]
CustosLimen has quit [*.net *.split]
ruskie has quit [*.net *.split]
baweaver has quit [*.net *.split]
sapphyrus has quit [*.net *.split]
hackeron has quit [*.net *.split]
darthThorik has joined #ruby
mbarbar has joined #ruby
baweaver has joined #ruby
badeball has joined #ruby
hahuang65 has joined #ruby
kevinsjoberg has joined #ruby
hackeron has joined #ruby
sapphyrus has joined #ruby
entel has joined #ruby
matti has joined #ruby
ruskie has joined #ruby
wbnns has joined #ruby
CustosLimen has joined #ruby
NODE has joined #ruby
cow[moo] has quit [Ping timeout: 258 seconds]
CustosLimen has quit [Max SendQ exceeded]
mbarbar has quit [Ping timeout: 240 seconds]
hahuang65 has quit [Ping timeout: 250 seconds]
coreyja has quit [Ping timeout: 246 seconds]
turt2live has quit [Ping timeout: 246 seconds]
stan has quit [Ping timeout: 260 seconds]
CustosLimen has joined #ruby
hahuang65 has joined #ruby
matti has quit [Ping timeout: 240 seconds]
hays is now known as rq
rq is now known as rw
rw is now known as rl
rl is now known as hays
sergioro has joined #ruby
hays is now known as s5
matti has joined #ruby
kinduff has quit [Read error: Connection reset by peer]
Furai has joined #ruby
kinduff has joined #ruby
markoong has joined #ruby
conta has quit [Quit: conta]
duderonomy has quit [Ping timeout: 256 seconds]
cisco has joined #ruby
LDonoughe has quit [Ping timeout: 260 seconds]
Exuma has joined #ruby
meowzus has joined #ruby
banisterfiend has joined #ruby
galaxie has quit [Remote host closed the connection]
galaxie has joined #ruby
roadie has joined #ruby
LDonoughe has joined #ruby
mbarbar has joined #ruby
klaas_ has joined #ruby
klaas_ is now known as klaas
burningserenity has joined #ruby
Emmanuel_Chanel has joined #ruby
Exuma has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
advorak has joined #ruby
cisco has quit [Ping timeout: 256 seconds]
stan has joined #ruby
turt2live has joined #ruby
bvdw has quit [Read error: Connection reset by peer]
bvdw has joined #ruby
dan64 has joined #ruby
TomyLobo2 has quit [Remote host closed the connection]
cschneid_ has quit [Ping timeout: 258 seconds]
cschneid has joined #ruby
cliluw has joined #ruby
vondruch_ has joined #ruby
vondruch has quit [Ping timeout: 250 seconds]
vondruch_ is now known as vondruch
mayurvpatil has joined #ruby
LDonoughe has quit [Ping timeout: 256 seconds]
davispuh has joined #ruby
banisterfiend has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
RiPuk has quit [Ping timeout: 252 seconds]
helpa has quit [Remote host closed the connection]
helpa has joined #ruby
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
duderonomy has joined #ruby
aesthe has joined #ruby
LDonoughe has joined #ruby
hiroaki has joined #ruby
dasher00 has joined #ruby
Emmanuel_Chanel has quit [Ping timeout: 260 seconds]
RiPuk has joined #ruby
LDonoughe has quit [Ping timeout: 240 seconds]
fercell has quit [Quit: WeeChat 2.7.1]
cliluw has quit [Ping timeout: 240 seconds]
cliluw has joined #ruby
fercell has joined #ruby
ur5us has joined #ruby
Emmanuel_Chanel has joined #ruby
xco has joined #ruby
ritalinona has quit [Remote host closed the connection]
ritalinona has joined #ruby
LDonoughe has joined #ruby
burningserenity has quit [Quit: Leaving.]
LDonoughe has quit [Ping timeout: 250 seconds]
sysh has quit [Remote host closed the connection]
ur5us has quit [Ping timeout: 240 seconds]
mayurvpatil has quit [Quit: This computer has gone to sleep]
cschneid has quit [Ping timeout: 256 seconds]
cschneid has joined #ruby
LDonoughe has joined #ruby
ur5us has joined #ruby
LDonoughe has quit [Ping timeout: 250 seconds]
s2013 has quit [Ping timeout: 256 seconds]
markopasha has joined #ruby
markopasha has quit [Max SendQ exceeded]
davor has quit [Ping timeout: 258 seconds]
KeyJoo has joined #ruby
patrick99e99 has joined #ruby
davor has joined #ruby
Arkantos has joined #ruby
<xco> In this
<xco> 'A'.upto('Z').with_index(127_462).to_h.freeze
<xco> what is the "127_462"?
<adam12> xco: 127,462
<xco> hahahahaha
<xco> good one
<patrick99e99> Hi everyone.. I am not sure if this is the place to ask-- but I am trying to do something involving openssl, and am getting: FFI::NotFoundError (Function 'OPENSSL_init_ssl' not found in [libssl.dylib])
<xco> i know
<xco> adam12 but what is it, what does it represent?
<al2o3-cr> xco: it's the code point for 🇦
<xco> al2o3-cr :D silly me did "A".unpack('U*') and got [65] and got confused
<xco> al2o3-cr thank you :)
<al2o3-cr> np :P
funnel has quit [Ping timeout: 260 seconds]
<al2o3-cr> [240, 159, 135, 166] this is the bytes
<xco> al2o3-cr if i have the codepoint how do i get the grapheme? I can't seem to copy this to check
<al2o3-cr> 🇦 is the grapheme
<xco> yes
<xco> but how do i get it in my terminal
<xco> ah i know
<xco> i just pack the codepoints
<xco> or not
<xco> [240, 159, 135, 166].pack('U*') => "ð\u009F\u0087¦"
<xco> hahaha i'm so lost!
<al2o3-cr> &>> [240, 159, 135, 166].pack('C*').unpack1('U')
<rubydoc> # => 127462 (https://carc.in/#/r/8suw)
<al2o3-cr> utf-8 is multibyte 1 to 6 bytes.
<al2o3-cr> but i'm not the best one to ask when it comes to unicode.
<al2o3-cr> &>> "\xF0\x9F\x87\xA6".chr
<rubydoc> # => "🇦" (https://carc.in/#/r/8sux)
<adam12> xco: Sorry. I thought you were asking about the underscore, not the actual value.
<al2o3-cr> encodings get get messy real quick.
<xco> adam12 that's fine :)
<xco> al2o3-cr whaaat? :D what's the C* directive?
<xco> where's havenwood ? :D
<al2o3-cr> xco: packs the bytes as a uint_8 as a binary string
<xco> got it
<al2o3-cr> what's the deal with grapheme though?
<al2o3-cr> &>> "\xF0\x9F\x87\xA6".chr.size # one unicode character
<rubydoc> # => 1 (https://carc.in/#/r/8suy)
<al2o3-cr> &>> "\xF0\x9F\x87\xA6".chr.bytesize # the bytes it takes to represent that unicode character
<rubydoc> # => 4 (https://carc.in/#/r/8suz)
<al2o3-cr> but, like i said, i'm not the one to ask really :P
<havenwood> &>> "🇦".ord
<rubydoc> # => 127462 (https://carc.in/#/r/8sv0)
<havenwood> &>> 127462.chr(Encoding::UTF_8)
<rubydoc> # => "🇦" (https://carc.in/#/r/8sv1)
<xco> al2o3-cr oh i agree. i'm now conviced encodings are a whole new different separate topic. you have to spend time to study it for it to make any sense
<al2o3-cr> xco: you really do.
<xco> havenwood 127462.chr(Encoding::UTF_8) < OK now i think i get what's going on
<xco> thanks guys... back to writing my blog post :D
<havenwood> &>> 127462.chr(Encoding::UTF_8).ord
<rubydoc> # => 127462 (https://carc.in/#/r/8sv2)
ellcs has quit [Ping timeout: 256 seconds]
<al2o3-cr> xco: btw, kovid state foo # obviously this is not a state errors.
<al2o3-cr> you might want to check that.
<xco> al2o3-cr not sure what you mean, kovid state michigan works for me here
<al2o3-cr> xco: i mean literally putting foo
<al2o3-cr> add some logic if not found or so.
<havenwood> &>> "a".ord
<rubydoc> # => 97 (https://carc.in/#/r/8sv9)
<havenwood> &>> "🇦".ord
<rubydoc> # => 127462 (https://carc.in/#/r/8sva)
<xco> al2o3-cr oh it says "Wrong spelling/No reported cases on FOO." doesn't make sense is that what you mean?
funnel has joined #ruby
<xco> havenwood i tested those out already locally so i understand those very well
<xco> al2o3-cr perhaps kovid state foo should explicitely state that foo is not a state?
<havenwood> xco: It might be kind to the reader to write it as: 'A'.upto('Z').with_index('🇦'.ord).to_h.freeze
<al2o3-cr> xco: nvm, i updated to gem it's fixed! ;)
<xco> al2o3-cr whew! :P
<al2o3-cr> me and my outdated gem :)
<xco> right
<havenwood> xco: For fun, here's another way to write it: Enumerator.produce(['A', '🇦'.ord]) { |ascii, utf| [ascii.succ, utf.succ] }.first(26).to_h.freeze
* al2o3-cr likes this ^
<xco> havenwood I see you like Enumerator.produce :D
<xco> this looks fun
<xco> i'm testing what will happen if i pust 30 to #first
<havenwood> &>> Enumerator.produce(['A', '🇦'.ord]) { _1.map(&:succ) }.first(26).to_h.freeze
<rubydoc> # => {"A"=>127462, "B"=>127463, "C"=>127464, "D"=>127465, "E"=>127466, "F"=>127467, "G"=>127468, "H"=>127469,... check link for more (https://carc.in/#/r/8sve)
<xco> &>> Enumerator.produce(['A', '🇦'.ord]) { |ascii, utf| [ascii.succ, utf.succ] }.first(30).to_h.freeze
<rubydoc> # => {"A"=>127462, "B"=>127463, "C"=>127464, "D"=>127465, "E"=>127466, "F"=>127467, "G"=>127468, "H"=>127469,... check link for more (https://carc.in/#/r/8svf)
<xco> OK :D
<al2o3-cr> xco: take a look at your code and update required_ruby_version in gemspec.
<al2o3-cr> i'd bump up to 2.4.0 at least.
<xco> al2o3-cr why though?
<xco> you don't like 2.3?
fercell has quit [Quit: WeeChat 2.7.1]
<havenwood> &>> Enumerator.produce(['A', '🇦'.ord]) { |ascii, utf| raise StopIteration if ascii == 'Z'; [ascii.succ, utf.succ] }.to_h.freeze
<al2o3-cr> i'd say it's to outdated now.
<rubydoc> # => {"A"=>127462, "B"=>127463, "C"=>127464, "D"=>127465, "E"=>127466, "F"=>127467, "G"=>127468, "H"=>127469,... check link for more (https://carc.in/#/r/8svg)
<xco> perhaps it's not supported anymore
<havenwood> xco: StopIteration ^ is another way to delimit the end.
<xco> al2o3-cr done
ellcs has joined #ruby
<xco> a bit confused here though
<xco> what you write something like
<xco> 'A'.upto('Z').with_index(127_462).to_h.freeze
NODE has quit [Quit: changing servers]
<havenwood> &>> Enumerator.new(26) { |yielder| 26.times { |n| yielder << [(n + 65).chr, n + 127462] } }.to_h.freeze
<rubydoc> # => {"A"=>127462, "B"=>127463, "C"=>127464, "D"=>127465, "E"=>127466, "F"=>127467, "G"=>127468, "H"=>127469,... check link for more (https://carc.in/#/r/8svh)
<xco> the codepoint of 'A' is like 65 right?
NODE has joined #ruby
<xco> how does ruby know to change 'A' to the grapheme with 127_462 as codepoint?
<al2o3-cr> xco: yes.
<al2o3-cr> ascii A is not 🇦
yokel has quit [Ping timeout: 240 seconds]
<xco> right, it's not
<xco> but what's the connection between 'A' and 127_462?
yokel has joined #ruby
<xco> because the code above just does on thing returns a hash of k,v pairs
<al2o3-cr> xco: nothing.
<havenwood> &>> [65, 127462].map { _1.chr Encoding::UTF_8 }
<rubydoc> # => ["A", "🇦"] (https://carc.in/#/r/8svi)
<havenwood> &>> [65, 97, 127462].map { _1.chr Encoding::UTF_8 }
<rubydoc> # => ["A", "a", "🇦"] (https://carc.in/#/r/8svj)
<xco> oh ok i think i get it
<al2o3-cr> it's a mapping mymap.values_at('U', 'S')
<xco> yesh so that we can pass string values to get an emoji in a code like this
<xco> def country_emoji(iso)
<xco> COUNTRY_LETTERS.values_at(*iso.chars).pack('U*')
<al2o3-cr> xco: yes.
<xco> end
<xco> ok ok got it
<xco> thanks
<xco> btw i really like this emoji method
<xco> it's really nifty
banisterfiend has joined #ruby
<al2o3-cr> it sure is nifty.
<al2o3-cr> &>> (127462..127487).each_with_object('') { |cp, s| s << cp }
<rubydoc> # => "🇦🇧🇨🇩🇪🇫🇬🇭🇮🇯🇰🇱🇲🇳🇴🇵🇶🇷🇸🇹🇺🇻🇼🇽🇾🇿" (https://carc.in/#/r/8svk)
<xco> al2o3-cr that's tripping me
<al2o3-cr> &>> (127462..127487).each_with_object('') { |cp, s| s << (cp ^ 32) }
<rubydoc> # =>... check link for more (https://carc.in/#/r/8svl)
<xco> al2o3-cr is it only recognizing ISO alpha-2 codes that exist and ignoring the rest?
<al2o3-cr> xco: yes.
<xco> al2o3-cr hahahah i have too many questions
LDonoughe has joined #ruby
<al2o3-cr> &>> (?A..?Z).each.with_index(127462).to_h
<rubydoc> # => {"A"=>127462, "B"=>127463, "C"=>127464, "D"=>127465, "E"=>127466, "F"=>127467, "G"=>127468, "H"=>127469,... check link for more (https://carc.in/#/r/8svm)
LDonoughe has quit [Ping timeout: 256 seconds]
<apotheon> Making the core of a simple piece of Ruby software a "while" loop felt like prying my own brain out with a crowbar.
<apotheon> It has literally been more than half a decade since I've used a while loop in Ruby. It just doesn't feel like it fits.
<havenwood> &>> [*127462..127487].permutation(2).map { |pair| pair.map { |codepoint| codepoint.chr Encoding::UTF_8 }.join }
<rubydoc> # => ["🇦🇧", "🇦🇨", "🇦🇩", "🇦🇪", "🇦🇫", "🇦🇬", "🇦🇭", "🇦🇮", "🇦🇯", "🇦🇰", "🇦🇱", "🇦🇲", "🇦🇳", "🇦🇴", "🇦🇵", "🇦🇶", "🇦🇷",... check link for more (https://carc.in/#/r/8svp)
<apotheon> Is this the countrycode->flag thing again?
<havenwood> apotheon: yes
<apotheon> cool
alfiemax has joined #ruby
<havenwood> Oops, repeated_permutation needed.
<al2o3-cr> havenwood: wouldn't that be repeated_combinations ?
<havenwood> &>> [*127462..127487].repeated_permutation(2).map { |pair| pair.map { |codepoint| codepoint.chr Encoding::UTF_8 }.join }
<rubydoc> # => ["🇦🇦", "🇦🇧", "🇦🇨", "🇦🇩", "🇦🇪", "🇦🇫", "🇦🇬", "🇦🇭", "🇦🇮", "🇦🇯", "🇦🇰", "🇦🇱", "🇦🇲", "🇦🇳", "🇦🇴", "🇦🇵", "🇦🇶",... check link for more (https://carc.in/#/r/8svq)
<havenwood> al2o3-cr: Repeated permutations would be all possible flags, but combinations wouldn't, right?
<al2o3-cr> i though repeated_combination would give you all possible flags.
<al2o3-cr> idk now :?
<havenwood> &>> [*'a'..'z'].repeated_combination(2).include?(['o', 'k'])
<al2o3-cr> havenwood: you might be right there.
<rubydoc> # => false (https://carc.in/#/r/8svs)
<havenwood> &>> [*'a'..'z'].repeated_permutation(2).include?(['o', 'k'])
<rubydoc> # => true (https://carc.in/#/r/8svt)
alfiemax has quit [Ping timeout: 260 seconds]
<al2o3-cr> ah, yes, you're right ;)
Swyper has joined #ruby
Swyper has quit [Remote host closed the connection]
ellcs has quit [Ping timeout: 240 seconds]
infinityfye has joined #ruby
<al2o3-cr> oh, yeah.
isxek has joined #ruby
NODE has quit [Quit: changing servers]
NODE has joined #ruby
schne1der has quit [Ping timeout: 264 seconds]
aesthe has quit [Remote host closed the connection]
cschneid has quit [Ping timeout: 256 seconds]
cschneid has joined #ruby
NODE has quit [Quit: changing servers]
NODE has joined #ruby
Swyper has joined #ruby
banisterfiend has quit [Read error: Connection reset by peer]
golevka has joined #ruby
patrick99e99 has quit [Quit: Lost terminal]
arahael2 has quit [Ping timeout: 265 seconds]
<xco> al2o3-cr havenwood is this a zero-width character?
<xco> 8203.chr(Encoding::UTF_8)
<xco> 8203 would be the codepoint of the zero-with character right?
<xco> no
<xco> that's space
<xco> no i don't know, guessing wildly
<xco> ('🇭🇹' + 8203.chr(Encoding::UTF_8)).size => 3
<xco> which makes me think 8203.chr(Encoding::UTF_8) is SPACE
infinityfye has quit [Remote host closed the connection]
<al2o3-cr> xco: yes. there are only 5 zero width chars.
<al2o3-cr> &>> [8203, 8204, 8205, 8288, 65279].pack('U*')
<rubydoc> # => "​‌‍⁠" (https://carc.in/#/r/8swy)
<xco> al2o3-cr yes as in 8203 is the code point for a zero-width character?
<al2o3-cr> xco: yes.
<xco> nice :)
<al2o3-cr> xco: what are you trying to accomplish?
<al2o3-cr> *ce
<xco> nothing. just trying to understand :)
<xco> i'm writing
<al2o3-cr> *hs
<al2o3-cr> oh, ok. ;P
<xco> sort of like reinforcing what i'm learning
<xco> :D
<al2o3-cr> cool ;)
<al2o3-cr> &>> "​‌‍⁠".bytes
<rubydoc> # => [226, 128, 139, 226, 128, 140, 226, 128, 141, 226, 129, 160, 239, 187, 191] (https://carc.in/#/r/8swz)
<al2o3-cr> what the f...
brendan- has quit [Ping timeout: 264 seconds]
<al2o3-cr> &>> "​‌‍⁠".scan /.{3}/n
<rubydoc> # => ["​‌‍"] stderr: -e:4: warning: historical binary regexp match /.../n against UTF-8 string (https://carc.in/#/r/8sx0)
<al2o3-cr> er, what.
<al2o3-cr> &26>> "​‌‍⁠".scan /.{3}/n
<rubydoc> # => ["​‌‍"] stderr: -e:4: warning: historical binary regexp match /.../n against UTF-8 string (https://carc.in/#/r/8sx1)
<al2o3-cr> &23>> "​‌‍⁠".scan /.{3}/n
<rubydoc> # => ["​‌‍"] stderr: -e:4: warning: regexp match /.../n against to UTF-8 string... check link for more (https://carc.in/#/r/8sx2)
<al2o3-cr> i could of sworn that worked.
<phaul> sort of worked.. stdout had answer, # => [""], just stderr wasn't clean
<al2o3-cr> heh ;)
<al2o3-cr> i must be thinking about something entirely diff.
arahael2 has joined #ruby
<al2o3-cr> xco: can you check this: https://ibb.co/RN8Q5kN i think the fourth column is broken.
<xco> al2o3-cr oh i think i know why
<xco> fixing it now
<al2o3-cr> xco: np. thought i'd let you know.
<xco> al2o3-cr thanks, should be fixed now if you update
<al2o3-cr> i'll check.
<al2o3-cr> xco: all is a-ok :)
<xco> <3
quarters has joined #ruby
<quarters> hello. is the only way to reassign the value of a key of a hash by referencing its symbol?
<quarters> or can dot notation be used like in js
<advorak> quarters, correct; dot notation is not supported by Ruby
<quarters> advorak: thank you
brendan- has joined #ruby
dionysus69 has quit [Ping timeout: 256 seconds]
<phaul> &>> class Hash; def method_missing(sym, args); self[sym.to_s[0...-1].to_sym] = args; end; end; h = {}; h.blah = 13; h
<rubydoc> # => {:blah=>13} (https://carc.in/#/r/8sx9)
<phaul> these kind of dirty hacks are not recommended though ^
<advorak> as phaul said, it is possible (as is anything in programming), but not supported by ruby :-)
<xco> which version of Ruby introduced binding.irb? 2.7?
<xco> or earlier?
<al2o3-cr> xco: 2.4 i believe
<xco> al2o3-cr correct
<xco> :D
frem has joined #ruby
arcaos has quit [Ping timeout: 252 seconds]
stooj has quit [Ping timeout: 240 seconds]
<al2o3-cr> xco: you've added a histogram, sweet!
<xco> al2o3-cr yeah, there's more work to be done on it though
<al2o3-cr> that looks pretty neat to me.
<xco> for the most part yeah
<xco> but the scale calculation behaves in a weir way if you try more countries
<xco> weird*
<apotheon> weir is cool, too
<xco> apotheon haha, i can agree on that
<al2o3-cr> xco: i was using this api for a bit `curl https://corona-stats.online/uk`
<al2o3-cr> now i'm using yours ;)
<xco> al2o3-cr hahahha that's satisfying :D :D
<al2o3-cr> :)
elphe has joined #ruby
bvdw has quit [Read error: Connection reset by peer]
bvdw has joined #ruby
isxek has quit [Quit: Lost terminal]
millerti has quit [Ping timeout: 256 seconds]
drincruz_ has quit [Ping timeout: 256 seconds]
Arkantos has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]