baweaver changed the topic of #ruby to: Rules & more: https://ruby-community.com | Ruby 2.6.3, 2.5.5, 2.4.6: 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!
bhaak has quit [Ping timeout: 255 seconds]
wald0 has quit [Quit: Lost terminal]
Azure has joined #ruby
hph^ has quit []
shah^ has joined #ruby
ramfjord_ has joined #ruby
eblip has quit [Read error: Connection reset by peer]
eb0t has quit [Read error: Connection reset by peer]
ramfjord has quit [Ping timeout: 255 seconds]
eb0t has joined #ruby
eblip has joined #ruby
Azure has quit [Remote host closed the connection]
Azure has joined #ruby
zachk has quit [Quit: Leaving]
AJA4350 has joined #ruby
kyrylo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
millerti has quit [Ping timeout: 246 seconds]
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Hobbyboy|BNC has joined #ruby
papcx8 has joined #ruby
iamdevnul_ has joined #ruby
manveru_ has joined #ruby
Fenhl_ has joined #ruby
mochiyoda_ has joined #ruby
leftylin1 has joined #ruby
pabs_ has joined #ruby
n13z_ has joined #ruby
znz_jp0 has joined #ruby
netwoodle has joined #ruby
twe4ked_ has joined #ruby
russt_ has joined #ruby
agit0 has joined #ruby
dumptruckman_ has joined #ruby
lghtstkr has joined #ruby
n13z has quit [*.net *.split]
manveru has quit [*.net *.split]
fluxAeon has quit [*.net *.split]
jcalla has quit [*.net *.split]
mochiyoda has quit [*.net *.split]
mcspud has quit [*.net *.split]
iamdevnul has quit [*.net *.split]
Lyubo1 has quit [*.net *.split]
ellcs has quit [*.net *.split]
Hobbyboy has quit [*.net *.split]
varesa has quit [*.net *.split]
Fenhl has quit [*.net *.split]
znz_jp has quit [*.net *.split]
papcx has quit [*.net *.split]
leftylink has quit [*.net *.split]
ryouba has quit [*.net *.split]
Fire-Dragon-DoL has quit [*.net *.split]
nowz has quit [*.net *.split]
mclee has quit [*.net *.split]
noodle has quit [*.net *.split]
twe4ked has quit [*.net *.split]
xtsee has quit [*.net *.split]
russt has quit [*.net *.split]
lightstalker has quit [*.net *.split]
dumptruckman has quit [*.net *.split]
pabs has quit [*.net *.split]
netwoodle is now known as noodle
iamdevnul_ is now known as iamdevnul
manveru_ is now known as manveru
twe4ked_ is now known as twe4ked
Fire-Dragon-DoL has joined #ruby
SeepingN has quit [Ping timeout: 268 seconds]
UnknownSoldier has quit [Ping timeout: 246 seconds]
AJA4350 has quit [Remote host closed the connection]
AJA4350 has joined #ruby
agit0 has quit [Ping timeout: 255 seconds]
Lyubo1 has joined #ruby
varesa_ has joined #ruby
dsmythe has quit [Read error: Connection reset by peer]
jcalla has joined #ruby
mclee has joined #ruby
xtsee has joined #ruby
pupsikov has joined #ruby
dsmythe has joined #ruby
mcspud has joined #ruby
nowz has joined #ruby
ryouba has joined #ruby
ellcs has joined #ruby
tdy1 has joined #ruby
pupsikov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
DTZUZO has joined #ruby
d^sh has quit [Ping timeout: 268 seconds]
Swyper has joined #ruby
ramfjord_ has quit [Ping timeout: 246 seconds]
d^sh has joined #ruby
Swyper has quit [Remote host closed the connection]
DTZUZO has quit [Ping timeout: 250 seconds]
ramfjord has joined #ruby
ramfjord has quit [Ping timeout: 250 seconds]
Swyper has joined #ruby
pabs_ is now known as pabs
jenrzzz has joined #ruby
KeyJoo has joined #ruby
jenrzzz has quit [Ping timeout: 246 seconds]
s2013 has joined #ruby
bambanx has joined #ruby
alnk_ has joined #ruby
alnk has quit [Quit: leaving]
DTZUZO has joined #ruby
zeroquake has joined #ruby
alnk_ is now known as alnk
<baweaver> Pattern Matching just landed in Ruby as an experimental feature: https://medium.com/@baweaver/ruby-2-7-pattern-matching-first-impressions-cdb93c6246e6
mangold has joined #ruby
Swyper has quit [Remote host closed the connection]
spacesuitdiver has joined #ruby
bhaak has joined #ruby
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
KeyJoo has quit [Quit: KeyJoo]
AJA4350 has quit [Quit: AJA4350]
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
laaron has joined #ruby
zeroquake has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Swyper has joined #ruby
braincrash has quit [Quit: bye bye]
Swyper has quit [Remote host closed the connection]
Swyper has joined #ruby
gix has quit [Ping timeout: 246 seconds]
braincrash has joined #ruby
<shalok> Is this the correct way to check if two strings are not equal?: if !('asdf' <=> 'sdfg')
<shalok> Seems a bit ugly so I thought maybe I missed a cleaner way.
<shalok> Actually that doesn't even work.
<shalok> I think I need something like: if ('asdf' <=> 'asdx') != 0 then puts 'hey'; end
<mozzarella> what's wrong with !=?
<mozzarella> am I missing something
<shalok> Oh right... I thought that was only for integers =/
maryo has joined #ruby
_whitelogger has joined #ruby
jenrzzz has joined #ruby
<havenwood> &>> Object.new != Object.new
<rubydoc> # => true (https://carc.in/#/r/6qsm)
maryo has quit [Ping timeout: 246 seconds]
UnknownSoldier has joined #ruby
UnknownSoldier has quit [Quit: .]
jenrzzz has quit [Ping timeout: 255 seconds]
duderonomy has joined #ruby
duderonomy has quit [Client Quit]
eckhardt has joined #ruby
bambanx has quit [Read error: Connection reset by peer]
duderonomy has joined #ruby
Swyper has quit [Remote host closed the connection]
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
ferr has joined #ruby
Inline has quit [Quit: Leaving]
ur5us_ has joined #ruby
ur5us has quit [Ping timeout: 250 seconds]
ur5us_ has quit [Ping timeout: 264 seconds]
houhoulis has quit [Remote host closed the connection]
kapil____ has joined #ruby
Swyper has joined #ruby
sauvin has joined #ruby
Fenhl_ is now known as Fenhl
<sagax> hi all!
<sagax> how to expand array? [1,2,3] to get 1, 2, 3
<sagax> some like as *[1,2,3]
eckhardt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<sagax> oh, nothing, i another problem
<havenwood> sagax: Hrm?
<havenwood> sagax: a splat like you showed would turn the Array into three arguments
<havenwood> Ruby doesn't have multiple return values
eckhardt has joined #ruby
tlarevo has joined #ruby
eckhardt has quit [Client Quit]
tlarevo has quit [Remote host closed the connection]
schleppel has joined #ruby
eckhardt has joined #ruby
claudiuinberlin has joined #ruby
mangold has quit [Quit: This computer has gone to sleep]
planigan has quit [Ping timeout: 255 seconds]
eckhardt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<sagax> why `Set` can't convert to json?
<sagax> i must cast `Set` to `Array` and after cast `Array` to `json`
<sagax> but it's strange
jenrzzz has joined #ruby
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jenrzzz has quit [Ping timeout: 246 seconds]
<ytti> to me it makes sense
<ytti> there is no set in json, so you couldn't read anything back to set either
<ytti> casting it to array makes things more self-documenting
mkaito has quit [Ping timeout: 257 seconds]
mkaito has joined #ruby
mkaito has joined #ruby
mkaito has quit [Changing host]
andikr has joined #ruby
<havenwood> sagax: Vanilla JSON doesn't support Set. That said, Ruby JSON actually does have optional support for Set.
<havenwood> sagax: require 'json/add/set'
planigan has joined #ruby
<havenwood> It's pretty obscure, but you can optionally enable JSON support for BigDecimal, Complex, Date, DateTime, Exception, OpenStruct, Range, Rational, Regexp, Set, Struct, Symbol and Time.
<ytti> how does it look whe nserialised? !ruby/set ...?
<havenwood> ytti: "{\"json_class\":\"Set\",\"a\":[]}"
<havenwood> That's ^ an empty Set.
<ytti> havenwood, ok
<ytti> at that point, personally i'd look into other serailisation formats
<ytti> which offer transferable set support
<havenwood> &>> require 'json/add/set'; Set.new([1, 2, 3]).to_json
<rubydoc> # => cannot load such file -- json/add/set (LoadError) stderr:... check link for more (https://carc.in/#/r/6qso)
<havenwood> phaul: ^ hmmm
clemens3_ has quit [Ping timeout: 246 seconds]
<havenwood> #=> "{\"json_class\":\"Set\",\"a\":[1,2,3]}"
<ytti> hmm protobuf doesn't support set either
<havenwood> "there is no plan to add a set type in protobuf"
reber has joined #ruby
<ytti> capnproto neither
<ytti> avro neither, well set seems surprisingly rare
<havenwood> ytti: I'd vote YAML with #safe_load and Set added to whitelist classes
<havenwood> &>> require 'psych'; Psych.safe_load "--- !ruby/object:Set\nhash: {}\n", [Set]
<rubydoc> # => uninitialized constant Set (NameError) stderr: -e:2:in `<main>': uninitialized constant Set (NameError) (https://carc.in/#/r/6qsp)
<havenwood> &>> require 'set'; require 'psych'; Psych.safe_load "--- !ruby/object:Set\nhash: {}\n", [Set]
<rubydoc> # => #<Set: {}> (https://carc.in/#/r/6qsq)
<ytti> messagepack doesn't have set either
<ytti> thrift has set
d^sh has quit [Quit: ZNC 1.6.1 - http://znc.in]
_joes_ has joined #ruby
d^sh has joined #ruby
<ytti> i would probably just use list and write in api specification that it should not contain duplicates :/
<ytti> and behaviour for list with duplicates is unspecified
TomyLobo has joined #ruby
clemens3_ has joined #ruby
lxsameer has joined #ruby
varesa_ is now known as varesa
alem0lars has joined #ruby
shah^ has quit []
eph^ has joined #ruby
aupadhye has joined #ruby
BH23 has joined #ruby
planigan has quit [Ping timeout: 246 seconds]
Dbugger has joined #ruby
lxsameer has quit [Ping timeout: 246 seconds]
TomyLobo has quit [Read error: Connection reset by peer]
TomyLobo has joined #ruby
ramfjord has joined #ruby
Swyper has quit [Remote host closed the connection]
planigan has joined #ruby
ramfjord has quit [Ping timeout: 268 seconds]
mkaito_ has joined #ruby
mkaito has quit [Ping timeout: 258 seconds]
cedum has joined #ruby
TomyLobo has quit [Read error: Connection reset by peer]
TomyLobo has joined #ruby
cedum has quit [Ping timeout: 258 seconds]
esrse has joined #ruby
dionysus69 has quit [Ping timeout: 246 seconds]
hightower2 has joined #ruby
dionysus69 has joined #ruby
TomyLobo has quit [Read error: Connection reset by peer]
jefffrails35 has joined #ruby
imadper` has quit [Remote host closed the connection]
imadper has joined #ruby
Jonopoly has joined #ruby
mangold has joined #ruby
<Jonopoly> Morning everyone
<Jonopoly> Anyone got any advice on automating a stress test using Ruby
<Jonopoly> Website is Java/React
TomyLobo has joined #ruby
_joes_ has quit [Ping timeout: 245 seconds]
BH23 has quit [Ping timeout: 244 seconds]
ojbfe7 has joined #ruby
jottr has joined #ruby
lxsameer has joined #ruby
lxsameer has quit [Ping timeout: 246 seconds]
kyrylo has joined #ruby
leftylin1 is now known as leftylink
lxsameer has joined #ruby
jenrzzz has joined #ruby
<jordanm> Jonopoly: apachebench for basic stuff, gatling for more complex load testing
<jordanm> neither use ruby, not sure why you need ruby specifically
jenrzzz has quit [Ping timeout: 255 seconds]
dionysus69 has quit [Ping timeout: 268 seconds]
<Jonopoly> Well atm we use ruby and selemiun
<Jonopoly> Language is easy for non-developers to follow
<Jonopoly> *easy-ish
<Jonopoly> Like python has locustio
marz_d`ghostman has joined #ruby
<marz_d`ghostman> I have a string with \n in it. How do I get erb to parse that and display a new line?
dionysus69 has joined #ruby
tlarevo has joined #ruby
Nicmavr has quit [Read error: Connection reset by peer]
<uplime> puts
<uplime> or print
Nicmavr has joined #ruby
ramfjord has joined #ruby
tlarevo has quit []
ramfjord has quit [Ping timeout: 255 seconds]
gregf_ has joined #ruby
reber__ has joined #ruby
reber has quit [Ping timeout: 268 seconds]
meruem has joined #ruby
dsmythe has quit [Remote host closed the connection]
dsmythe has joined #ruby
kapil____ has quit [Quit: Connection closed for inactivity]
Azure has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
_joes_ has joined #ruby
BH23 has joined #ruby
kyrylo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ojbfe7 has quit [Quit: Bye]
DmitryBochkarev has joined #ruby
DmitryBochkarev has quit [Client Quit]
za1b1tsu has joined #ruby
Jonopoly has quit [Quit: WeeChat 2.4]
Sina has joined #ruby
sphenxes has joined #ruby
AJA4350 has joined #ruby
za1b1tsu has quit [Remote host closed the connection]
Jonopoly has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 255 seconds]
schne1der has joined #ruby
ramfjord has joined #ruby
agent_white has quit [Quit: brb]
agent_white has joined #ruby
laaron has quit [Remote host closed the connection]
ramfjord has quit [Ping timeout: 255 seconds]
laaron has joined #ruby
_joes_ has quit [Ping timeout: 246 seconds]
BH23 has quit [Ping timeout: 268 seconds]
wald0 has joined #ruby
Jonopoly has quit [Quit: WeeChat 2.4]
ldnunes has joined #ruby
_joes_ has joined #ruby
BH23 has joined #ruby
kapil____ has joined #ruby
<dostoyevsky> irb crashes on me when I accidentally enter a character like ≠¢ which happens some times when I enter []{} ... I often spot my mistake and delete the character but irb will get an exception the next time I hit enter, as some residue of that character is still there somehow
tdy1 has quit [Ping timeout: 268 seconds]
liuyiwen has joined #ruby
<dostoyevsky> > /usr/local/lib/ruby/2.5/irb/ruby-lex.rb:721:in `block in lex_int2': invalid byte sequence in UTF-8 (ArgumentError)
liuyiwen has left #ruby [#ruby]
mangold has quit [Quit: This computer has gone to sleep]
Jonopoly has joined #ruby
<phaul> dostoyevsky: do you have an UTF-8 locale?
<phaul> cat /etc/locale.conf => LANG=en_GB.UTF-8
<dostoyevsky> phaul: LC_CTYPE=en_US.UTF-8
<dostoyevsky> but a German keyboard...
<dostoyevsky> And readline in irb requires two backspace to delete ≠
<dostoyevsky> if I only do one backspace, then I will get that UTF-8 error
<dostoyevsky> I tried irb -E UTF-8:UTF-8 and -U but it didn't help
<phaul> requires two backspace: I'm not sure if this is to do with the terminal you are in
mangold has joined #ruby
<phaul> fwiw I can delete ≠ with one keystroke in both irb and just in the shell. (termite terminal)
<dostoyevsky> hmmm... I just tried python and there ≠ also requires two backspace to be deleted...
<dostoyevsky> hmmmm... also works on my linux box...
<dostoyevsky> but not on the openbsd box...
mangold has quit [Quit: This computer has gone to sleep]
kyrylo has joined #ruby
mangold has joined #ruby
ldnunes has quit [Ping timeout: 268 seconds]
tdy1 has joined #ruby
waronline00001 has joined #ruby
waronline00001 has quit [Client Quit]
esrse has quit [Ping timeout: 244 seconds]
Silex has joined #ruby
al2o3-cr has quit [Quit: If the universe is a machine where the future is uniquely determined by its present state, it would not be possible to calculate what the future will be.]
catbusters has joined #ruby
ldnunes has joined #ruby
tdy1 is now known as tdy
SuperL4g_ has joined #ruby
Sup3rLurk has joined #ruby
ljarvis_ has quit [Ping timeout: 255 seconds]
SuperL4g has quit [Ping timeout: 246 seconds]
SuperLag has quit [Ping timeout: 268 seconds]
tdy has quit [Ping timeout: 244 seconds]
helpa has quit [Remote host closed the connection]
helpa has joined #ruby
helpa has quit [Remote host closed the connection]
helpa has joined #ruby
dsmythe has quit [Remote host closed the connection]
dsmythe has joined #ruby
voxxit has quit [Ping timeout: 264 seconds]
al2o3-cr has joined #ruby
jenrzzz has joined #ruby
schne1der has quit [Ping timeout: 255 seconds]
voxxit has joined #ruby
jenrzzz has quit [Ping timeout: 250 seconds]
ljarvis__ has joined #ruby
fluxAeon has joined #ruby
spacesuitdiver has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mangold has quit [Quit: This computer has gone to sleep]
marz_d`ghostman has quit [Ping timeout: 256 seconds]
Mia has quit [Read error: Connection reset by peer]
claudiuinberlin has joined #ruby
claudiuinberlin has quit [Client Quit]
Azure has joined #ruby
claudiuinberlin has joined #ruby
jelera has joined #ruby
schne1der has joined #ruby
fluxAeon has quit [Quit: Textual IRC Client: www.textualapp.com]
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #ruby
Rudd0^ has joined #ruby
Rudd0 has quit [Read error: Connection reset by peer]
reber__ has quit [Remote host closed the connection]
jelera has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jelera has joined #ruby
SeepingN has joined #ruby
Mia has joined #ruby
Mia has quit [Changing host]
Mia has joined #ruby
Mia has quit [Read error: Connection reset by peer]
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
fanta1 has joined #ruby
laaron has joined #ruby
krawchyk has joined #ruby
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Silex has quit [Quit: Page closed]
aupadhye has quit [Remote host closed the connection]
nowhereman has joined #ruby
Swyper has joined #ruby
ellcs has quit [Remote host closed the connection]
Swyper has quit [Remote host closed the connection]
lord4163 has joined #ruby
zeroquake has joined #ruby
fanta1 has quit [Quit: fanta1]
Inline has joined #ruby
mangold has joined #ruby
Swyper has joined #ruby
lucasb has joined #ruby
GodFather has quit [Ping timeout: 246 seconds]
GodFather has joined #ruby
RedNifre has joined #ruby
<RedNifre> Hi there. If I want to implement a very old school BASIC compiler (line numbers, goto etc.), are there any good tokenizer/parser libraries I could use?
jelera has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<RedNifre> (It's for compiling basic programs for my old calculator that is programmed in something that feels like machine language)
ellcs has joined #ruby
agent_white has quit [Quit: brb]
mangold has quit [Quit: This computer has gone to sleep]
ellcs has quit [Remote host closed the connection]
jelera has joined #ruby
pupsikov has joined #ruby
mangold has joined #ruby
ferr has quit [Quit: WeeChat 2.4]
catbusters has quit [Quit: Connection closed for inactivity]
Dbugger has quit [Quit: Leaving]
DTZUZO has quit [Ping timeout: 246 seconds]
Dbugger has joined #ruby
agent_white has joined #ruby
Swyper has quit [Remote host closed the connection]
s2013 has joined #ruby
Mia has joined #ruby
Mia has joined #ruby
Mia has quit [Changing host]
Azure has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Jonopoly has quit [Quit: WeeChat 2.4]
Mia has quit [Read error: Connection reset by peer]
Swyper has joined #ruby
clemens3_ has quit [Ping timeout: 246 seconds]
jottr has quit [Ping timeout: 246 seconds]
zeroquake has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Swyper has quit [Remote host closed the connection]
UnknownSoldier has joined #ruby
houhoulis has joined #ruby
dsmythe has quit [Ping timeout: 244 seconds]
suukim has joined #ruby
zeroquake has joined #ruby
BH23 has quit [Ping timeout: 244 seconds]
_joes_ has quit [Ping timeout: 255 seconds]
polishdub has joined #ruby
dsmythe has joined #ruby
mangold has quit [Quit: This computer has gone to sleep]
jxpond has joined #ruby
jxpond has left #ruby [#ruby]
duderonomy has joined #ruby
jottr has joined #ruby
millerti has joined #ruby
zeroquake has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
zeroquake has joined #ruby
jottr has quit [Ping timeout: 244 seconds]
<phaul> RedNifre: for lexer/tokenization there is stdlib StringScanner.
<phaul> for parsing I have used parslet in the past, but there is also whittle
<phaul> I don't think you need an explicit tokenization for either, you just use regexps for your terminals
RedNifre has quit [Ping timeout: 252 seconds]
RedNifre has joined #ruby
duderonomy has quit [Ping timeout: 240 seconds]
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
noodle has quit [Ping timeout: 252 seconds]
jelera has quit [Quit: Textual IRC Client: www.textualapp.com]
rippa has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 268 seconds]
duderonomy has joined #ruby
imadper has quit [Ping timeout: 255 seconds]
imadper has joined #ruby
stimpy_ has joined #ruby
stimpy__ has joined #ruby
cd has quit [Quit: cd]
stimpy__ has quit [Client Quit]
stimpy_ has quit [Quit: Leaving]
SuperL4g_ is now known as SuperLag
powerbit has quit [Quit: Going offline, see ya! (www.adiirc.com)]
stimpy_ has joined #ruby
ropeney_ has quit [Ping timeout: 244 seconds]
zachk has joined #ruby
ByronJohnson has quit [Ping timeout: 246 seconds]
zachk has quit [Read error: Connection reset by peer]
xco has joined #ruby
zachk has joined #ruby
<xco> hello! it’s me again :P
<xco> i’m in IRB
<xco> how can i be sure i’m encoding strings the way i want
<xco> this is what i’m trying
<xco> str.encode("UTF-8")
ByronJohnson has joined #ruby
ropeney has joined #ruby
<xco> where ‘str’ = “some string"
<xco> but i’m not sure it’s working because i’m working on a string that looks like this
<xco> str = “noël”
<RedNifre> looks like french?
<xco> when i do str.length i get 5. which is weird
zachk has quit [Changing host]
zachk has joined #ruby
<xco> i don’t know what language “noël” is hahahahha
<xco> i’m just playing with it
<xco> but i doubt french has that kind of “e”. IDK :P
<RedNifre> It's french and means christmas. If it's UTF-8 and 5 long it looks like the unicode format that encodes the e with the diaresis as one character.
<xco> ah right, fuck it :P
<RedNifre> it means you pronounce it "no-el"
<RedNifre> like "naive" with two dots on the i
sameerynho has joined #ruby
stimpy_ has quit [Remote host closed the connection]
<xco> so how do i get Ruby to tell me “noël” is 4 characters? why can’t Ruby know the encoding and count correct?
<xco> correctly*
<RedNifre> Looks like everything is working, but you need to be careful, if you are on a mac and use that as a file name, MacOS will turn it into a different representation so when you read it back in it will be at least 7 bytes I think.
<xco> it’s weird to see “noël” as length of 5 in Ruby
<xco> wow!
<RedNifre> length is the byte count. You might want the grapheme cluster count, but I don't know if Ruby has a function for that.
SeepingN has quit [Ping timeout: 244 seconds]
<xco> you just blew my mind hahaha
<RedNifre> MacOS will store it as "noe<dots on the previous character>l" kinda.
SeepingN_ has joined #ruby
sphenxes has quit [Quit: Leaving]
ByronJohnson has quit [Ping timeout: 255 seconds]
<RedNifre> Ruby might have a code point count which will work in that case, but not if you read it as a file name on MacOS. Hm.
<RedNifre> Text is tricky :)
ByronJohnson has joined #ruby
lxsameer has quit [Ping timeout: 245 seconds]
<xco> i’m doing all this in irb
<xco> Elixir conveniently provides byte_size(str) and String.length(str) so i thought there’d be something similar in Ruby
<RedNifre> I only know about Swift counting grapheme clusters correctly, I hope more languages will offer that feature in the future.
<RedNifre> Also, according to legend, there is a giant several hundred MB large C library from IBM somewhere, that is the only thing that can handle Unicode correctly. If you can get that to work you might be able to get the correct character count.
<xco> this is rocket science
<xco> at least to me
<xco> and weird at the same time
<xco> a lot of languages have this
<xco> and Ruby’s community is big enough to have it too. if no one does it i’ll fix this! :P
krawchyk has quit [Quit: krawchyk]
<xco> give me a year
<xco> 6months tops, first i have to learn unicode
<RedNifre> Your string would fit into ISO/IEC 8859-15, so convert it to that to get a 4 byte string ;)
<RedNifre> (That's a really bad idea and was meant as a joke)
<xco> oh really? why would it be a bad idea?
<RedNifre> Because then you couldn't mix it with Japanese or Russian text any more. It wouldn't be Unicode.
<xco> :(
<xco> sad
<RedNifre> If you want to count the grapheme characters correctly here's how: http://www.unicode.org/reports/tr29/
<xco> all this while i thought Date/Time was the most complicated, i’m adding Strings to that list
<xco> btw in irb i’m doing something like this
krawchyk has joined #ruby
<xco> str.encode("ISO-8859-1")
<xco> not sure if it makes sense, prolly doesn’t because i’m getting back
<RedNifre> That's even worse, that doesn't even have the EUR sign.
<xco> Encoding::UndefinedConversionError (U+0308 from UTF-8 to ISO-8859-1)
<RedNifre> Oh, wow!
<RedNifre> You have a U+0308 in there?
<RedNifre> Then 5 is the correct code point length, because your string is actually "noe<dots on previous char>l"
<RedNifre> Try the length of this in IRB (Copy paste it!) "noël"
<xco> 4!!!!
<xco> what the hell?!?!? hahahhaa
<RedNifre> Yeah, so it does in fact count the unicode code points.
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<RedNifre> With your string, do s[2] to get "e" and s[3] to get the dots.
<RedNifre> With my string, s[2] should give you the single character "e with dots"
<xco> where did you get "noël" from? it acting differently from my "noël”!!
<RedNifre> Yeah, I got it from Wikipedia, the article name is written with the "E WITH DIARESIS" character, while your String has an "E" followed by "COMBININD DIARESIS", so your string has the dots as a separate combining character.
andikr has quit [Remote host closed the connection]
<xco> ah i see!
<xco> this is interesting
<xco> to the eye this is very confusing to someone who doesn’t know what’s going on under cover https://gyazo.com/cfe70707fe809fe51bbd9df8f7d79eb8
<xco> thanks for the enlightenment!
<RedNifre> Even more fun: Those two strings are identical according to Unicode.
<xco> got some reference online?
<RedNifre> MacOS respects that, you can use both strings to open a file with that name, because MacOS converts all representations to the same format before writing it to disk.
<RedNifre> Well, unicode.org? Or just some random stuff.
<RedNifre> I mostly learn Unicode when something doesn't work as expected ;)
<RedNifre> Hey, do you have Emoji in your IRB?
<xco> i guess strings and encodings are a whole new subject to be studies carefuly
<xco> lly*
<RedNifre> yes
gregf_ has quit [Ping timeout: 256 seconds]
<RedNifre> Which country are you from and do you have Emoji-Support in your IRB? :D
go|dfish has joined #ruby
<RedNifre> Dammit, looks like Ubuntu doesn't do flags in the terminal.
<RedNifre> If you are on MacOS you could try reversing "🇺🇸🇪🇪" (USA flag followed by Estland Flag).
noboruma has quit [Quit: leaving]
<RedNifre> Estland flag should stay as it is, but the USA flag should turn into the Soviet Union flag when reversed (Though I don't think that any platform has that flag supported).
<ytti> indeed in UTF8 ë can be 1 or 2 runes
<ytti> there is specific rune for it, but you can also compose it from two runes
<ytti> they will be rendered exactly the same
<ytti> and this leads to all kind of consufing behaviour
hightower2 has quit [Ping timeout: 245 seconds]
duderonomy has joined #ruby
UnknownSoldier has quit [Ping timeout: 246 seconds]
<RedNifre> Yeah, dealing with Unicode can lead to a lot of 🐛🐞 if you are not careful.
zeroquake has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<ytti> macOS uses fully decomposed umlauts when creating screenshot name in international versions
<ytti> which i've never seen used anywhere else
<ytti> where as all users of those languages use exclusively fully composed versions
<ytti> further, differnt shells and tools interepret them as different or same
<ytti> so you may end up in siitaution where you have same file twice in fielsystem, but some tools will only see it once
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<ytti> also renaming and overwriting may happen, as some tools implicitly convert to fully composed format
mangold has joined #ruby
cedum has joined #ruby
krawchyk has quit [Quit: krawchyk]
mangold has quit [Client Quit]
nowhereman has quit [Read error: Connection reset by peer]
nowhere_man has joined #ruby
dellavg_ has joined #ruby
Swyper has joined #ruby
duderonomy has joined #ruby
zeroquake has joined #ruby
Azure has joined #ruby
duderonomy has quit [Client Quit]
Cthulu201 has quit [Quit: Nowhere special. I always wanted to go there.]
krawchyk has joined #ruby
Cthulu201 has joined #ruby
nowhere_man has quit [Ping timeout: 250 seconds]
alem0lars has quit [Remote host closed the connection]
ta_ has quit [Ping timeout: 252 seconds]
powerbit has joined #ruby
duderonomy has joined #ruby
claudiuinberlin has joined #ruby
duderonomy has quit [Client Quit]
nahra has quit [Ping timeout: 264 seconds]
ramfjord has joined #ruby
sauvin has quit [Ping timeout: 244 seconds]
cedum has quit [Ping timeout: 250 seconds]
<shalok> Is it possible to assign a variable to the output of a case statement?
<shalok> something like: x = case my_string; when /asdf/ then 123; when /zxcv/ then 456; else 789; end
<lupine> yeah, that works fine
<lupine> everything in ruby is an expression
<shalok> lupine: Well irb doesn't report an error, but x doesn't seem to have a value after I execute ^
<shalok> argh
<shalok> I somehow ended up inside a state and had to type `end` a few times =/
<shalok> that's why I wasn't getting any output. oops =)
<lupine> ctrl+c will get you out of most irb-related fails
<shalok> yeah it works great, thanks
<lupine> related to case - anyone seen the upcoming ` case...in` pattern-matching thing?
ta_ has joined #ruby
Azure has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tdy1 has joined #ruby
claudiuinberlin has joined #ruby
meruem has quit [Remote host closed the connection]
meruem has joined #ruby
duderonomy has joined #ruby
schleppel has left #ruby ["Konversation terminated!"]
AJA4351 has joined #ruby
reber has joined #ruby
AJA4350 has quit [Ping timeout: 255 seconds]
AJA4351 is now known as AJA4350
cedum has joined #ruby
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ramfjord has quit [Ping timeout: 245 seconds]
suukim has quit [Remote host closed the connection]
ramfjord has joined #ruby
aert has joined #ruby
lucasb has quit [Quit: Connection closed for inactivity]
hightower2 has joined #ruby
mochiyoda_ is now known as mochiyoda
maryo has joined #ruby
xco has quit [Quit: xco]
za1b1tsu has joined #ruby
ldnunes has quit [Ping timeout: 250 seconds]
Mia has joined #ruby
Mia has joined #ruby
Mia has quit [Changing host]
jcarl43 has joined #ruby
tdy1 has quit [Ping timeout: 246 seconds]
znz_jp0 has quit [Ping timeout: 240 seconds]
Swyper has quit [Remote host closed the connection]
jcalla has quit [Remote host closed the connection]
ldnunes has joined #ruby
ldnunes has quit [Ping timeout: 250 seconds]
<lupine> baweaver: does it make your spine crawl as much as mine? ^^
aert has quit [Quit: Leaving]
ramfjord has quit [Ping timeout: 244 seconds]
cedum has quit [Ping timeout: 240 seconds]
rem_ has joined #ruby
Mia has quit [Read error: Connection reset by peer]
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
ldnunes has joined #ruby
kapil____ has quit [Quit: Connection closed for inactivity]
duderonomy has joined #ruby
maryo_ has joined #ruby
maryo__ has joined #ruby
aert has joined #ruby
duderonomy has quit [Client Quit]
dsmythe has quit [Remote host closed the connection]
dsmythe has joined #ruby
Swyper has joined #ruby
maryo has quit [Ping timeout: 250 seconds]
kapil____ has joined #ruby
duderonomy has joined #ruby
UnknownSoldier has joined #ruby
aert has quit [Quit: WeeChat 1.4]
maryo__ has quit [Quit: Leaving]
maryo_ has quit [Quit: Leaving]
Swyper has quit [Ping timeout: 246 seconds]
evdubs_ has joined #ruby
aert has joined #ruby
evdubs has quit [Ping timeout: 240 seconds]
dellavg_ has quit [Ping timeout: 268 seconds]
schne1der is now known as schneider
schneider has quit [Quit: WeeChat 1.9.1]
RiPuk has quit [Quit: ZNC 1.7.3 - https://znc.in]
RedNifre has quit [Ping timeout: 268 seconds]
aert has quit [Quit: WeeChat 2.4]
ramfjord has joined #ruby
aert has joined #ruby
aert has quit [Client Quit]
aert has joined #ruby
aert has quit [Client Quit]
aert has joined #ruby
Swyper has joined #ruby
Mia has joined #ruby
Mia has quit [Changing host]
Mia has joined #ruby
Azure has joined #ruby
zeroquake has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
zeroquake has joined #ruby
zeroquake has quit [Client Quit]
RiPuk has joined #ruby
evdubs__ has joined #ruby
Swyper has quit [Ping timeout: 255 seconds]
Fernando-Basso has joined #ruby
evdubs_ has quit [Read error: Connection reset by peer]
krawchyk has quit [Quit: krawchyk]
fluxAeon_ has quit [Quit: Textual IRC Client: www.textualapp.com]
evdubs_ has joined #ruby
maryo has joined #ruby
evdubs__ has quit [Ping timeout: 268 seconds]
ldnunes has quit [Quit: Leaving]
evdubs_ is now known as evdubs
dsmythe_ has joined #ruby
fluxAeon has joined #ruby
dsmythe has quit [Ping timeout: 245 seconds]
dsmythe__ has joined #ruby
dsmythe_ has quit [Ping timeout: 264 seconds]
pupsikov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jefffrails35 has quit [Remote host closed the connection]
<IGnorAND> is !empty? considered better than .length > 0
polishdub has quit [Remote host closed the connection]
elomatreb has quit [Quit: mep mep]
<phaul> in general asking objects from outside and let them do stuff inside is better. Here I think it's obrderline cargo culting
RiPuk has quit [Ping timeout: 244 seconds]
<phaul> borderline
<phaul> still fewer characters and somewhat more expressive code
SirFunk has quit [Quit: ZNC - http://znc.in]
evdubs has quit [Quit: Leaving]
<phaul> but nothing really wrong with either
dsmythe__ has quit [Remote host closed the connection]
mikeiniowa has quit [Remote host closed the connection]
dsmythe has joined #ruby
mikeiniowa has joined #ruby
SirFunk has joined #ruby
reber has quit [Remote host closed the connection]
aert has quit [Quit: WeeChat 2.4]
RiPuk has joined #ruby
<IGnorAND> phaul: thanks, rubocop told me to change it so I did, but thought it was more efficient to do a comparison on length. expressive and allowing objects to figure it out seem like good arguments.
evdubs has joined #ruby
<IGnorAND> Anyone know how to refactor this: https://gist.github.com/nuheluxulu/dd89a5551b2071795b663137ae3a8f10 I did the rescue to place default values
Swyper has joined #ruby
<IGnorAND> would I have to write a private attr_writer for the arguments?
aert has joined #ruby
zachk has quit [Quit: Leaving]
<phaul> line 9-13 are the same as line 14-18?
<phaul> is thata typo or intended?
<IGnorAND> phaul: typo.
<IGnorAND> 14-18 can be deleted
<IGnorAND> @page = opts[:page].is_a? Integer ? Integer(opts[:page]) : 1 <- this would be a one liner, but doesn't really make it more expressive
aert has quit [Quit: Leaving]
aert has joined #ruby
aert_ has joined #ruby
aert_ has quit [Remote host closed the connection]
aert has quit [Client Quit]
<IGnorAND> meh, that doesnt even work :(
aert has joined #ruby
<phaul> if one line is the goal you can suffix rescue. but I don't like that way either
<phaul> &>> raise 'hell' rescue 1666
<rubydoc> # => 1666 (https://carc.in/#/r/6qyt)
<IGnorAND> phaul: that's the code I had before
<phaul> :)
<IGnorAND> &>> @page = Integer(opts[:page]) rescue 1
<rubydoc> # => 1 (https://carc.in/#/r/6qyu)
<phaul> when can opts return something that Integer fails on? Is this just nil check?
<phaul> if so maybe use Hash#fetch on opts
<phaul> with default
<IGnorAND> phaul: Integer("seven") would fail
<phaul> and that can be in opts.. bummer
<IGnorAND> can I do set_page(opts[:page]) and do a def set_page(page_number) with the begin rescue etc there?
noboruma has joined #ruby
<phaul> sure that would get down the complexity of the initialize, but I would have liked to solve the whole begin..end shenenigans if I could
sameerynho has quit [Ping timeout: 255 seconds]
<phaul> I think, it's fine to have to deal with bad inputs and rescuing exceptions/type checking at system boundaries and IO. In fact it's unavoidable. Just don't do it everywhere. Internal objects should trust each other
<phaul> and should really send good data
hightower2 has quit [Ping timeout: 268 seconds]
Swyper has quit [Remote host closed the connection]
terabytes has joined #ruby
<phaul> so depending on where the initialize can be called from, maybe the right refactor is to get rid of error checking full stop
Swyper has joined #ruby
Swyper has quit [Remote host closed the connection]
<IGnorAND> I was thinking of doing that as well, but then again stop errors as soon as possible?
<phaul> exactly. not even here further up where opts is assembled
<shalok> So I know this is horrible, but is there any way to check the number of arguments that a method expects?
<phaul> IGnorAND: then you don't even call Thisclass.new if you don't have data it can work with.
Azure has quit [Read error: Connection reset by peer]
<phaul> It's find to have Thisclass.can_you_accept?(opts) method if you want the logic in the class
<phaul> still no exception
<leftylink> &ri Method#parameters might be what shalok wants?
<phaul> s/find/fine/
<IGnorAND> @shalok "".method(:is_a?).arity
<phaul> idea is to push errors out all the way to where the data comes in
<IGnorAND> &ri Method#arity might be what interesting
<IGnorAND> phaul: I suppose
noboruma has quit [Remote host closed the connection]
Azure has joined #ruby
uplime34 has joined #ruby
uplime34 is now known as also_uplime
kapil____ has quit [Quit: Connection closed for inactivity]
za1b1tsu has quit [Remote host closed the connection]
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 246 seconds]
AJA4351 is now known as AJA4350
galaxie has quit [Remote host closed the connection]
galaxie has joined #ruby
also_uplime has quit [Remote host closed the connection]
UnknownSoldier has quit [Ping timeout: 246 seconds]