<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 ...?
<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]
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…]
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.
<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.
<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]
<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…]
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.
<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?