« Back to channel list

#ruby - 18 April 2019

« Back 1 day Forward 1 day »
[00:08:57] Azure: has joined #ruby
[00:21:20] shah^: has joined #ruby
[00:22:36] ramfjord_: has joined #ruby
[00:27:21] eb0t: has joined #ruby
[00:27:21] eblip: has joined #ruby
[00:35:10] Azure: has joined #ruby
[00:41:58] AJA4350: has joined #ruby
[00:54:23] Hobbyboy|BNC: has joined #ruby
[00:54:59] papcx8: has joined #ruby
[00:55:08] iamdevnul_: has joined #ruby
[00:55:20] manveru_: has joined #ruby
[00:55:29] Fenhl_: has joined #ruby
[00:56:04] mochiyoda_: has joined #ruby
[00:57:34] leftylin1: has joined #ruby
[00:57:40] pabst: has joined #ruby
[00:58:04] n13z_: has joined #ruby
[00:58:40] znz_jp0: has joined #ruby
[01:00:36] netwoodle: has joined #ruby
[01:00:49] twe4ked_: has joined #ruby
[01:00:59] russt_: has joined #ruby
[01:01:10] agit0: has joined #ruby
[01:01:20] dumptruckman_: has joined #ruby
[01:02:15] lghtstkr: has joined #ruby
[01:03:09] Fire-Dragon-DoL: has joined #ruby
[01:05:32] AJA4350: has joined #ruby
[01:07:45] Lyubo1: has joined #ruby
[01:08:22] varesa_: has joined #ruby
[01:08:51] jcalla: has joined #ruby
[01:08:53] mclee: has joined #ruby
[01:09:04] xtsee: has joined #ruby
[01:09:05] pupsikov: has joined #ruby
[01:09:27] dsmythe: has joined #ruby
[01:09:33] mcspud: has joined #ruby
[01:09:34] nOwz: has joined #ruby
[01:10:04] ryouba: has joined #ruby
[01:11:15] ellcs: has joined #ruby
[01:21:52] tdy1: has joined #ruby
[01:33:52] DTZUZO: has joined #ruby
[01:34:10] Swyper: has joined #ruby
[01:37:07] d^sh: has joined #ruby
[01:39:03] ramfjord: has joined #ruby
[01:57:03] Swyper: has joined #ruby
[02:19:22] jenrzzz: has joined #ruby
[02:20:56] KeyJoo: has joined #ruby
[02:35:14] s2013: has joined #ruby
[02:35:21] bambanx: has joined #ruby
[02:38:19] alnk_: has joined #ruby
[02:40:04] DTZUZO: has joined #ruby
[02:40:22] zeroquake: has joined #ruby
[02:45:09] baweaver: Pattern Matching just landed in Ruby as an experimental feature: https://medium.com/@baweaver/ruby-2-7-pattern-matching-first-impressions-cdb93c6246e6
[02:45:09] baweaver: ...and some more practical examples: https://medium.com/@baweaver/ruby-2-7-pattern-matching-destructuring-on-point-90f56aaf7b4e
[02:47:02] mangold: has joined #ruby
[02:54:23] spacesuitdiver: has joined #ruby
[02:56:48] bhaak: has joined #ruby
[03:02:18] laaron: has joined #ruby
[03:03:50] Swyper: has joined #ruby
[03:06:54] Swyper: has joined #ruby
[03:11:42] braincrash: has joined #ruby
[03:34:23] shalok: Is this the correct way to check if two strings are not equal?: if !('asdf' <=> 'sdfg')
[03:34:47] shalok: Seems a bit ugly so I thought maybe I missed a cleaner way.
[03:36:30] shalok: Actually that doesn't even work.
[03:36:51] shalok: I think I need something like: if ('asdf' <=> 'asdx') != 0 then puts 'hey'; end
[03:37:32] mozzarella: what's wrong with !=?
[03:37:46] mozzarella: am I missing something
[03:37:51] shalok: Oh right... I thought that was only for integers =/
[03:56:43] maryo: has joined #ruby
[04:00:12] _whitelogger: has joined #ruby
[04:00:17] jenrzzz: has joined #ruby
[04:00:37] havenwood: &>> Object.new != Object.new
[04:00:42] rubydoc: # => true (https://carc.in/#/r/6qsm)
[04:09:00] UnknownSoldier: has joined #ruby
[04:29:28] duderonomy: has joined #ruby
[04:34:04] eckhardt: has joined #ruby
[04:37:28] duderonomy: has joined #ruby
[04:57:18] laaron: has joined #ruby
[05:03:57] ferr: has joined #ruby
[05:16:00] ur5us_: has joined #ruby
[05:32:21] kapil____: has joined #ruby
[05:32:31] Swyper: has joined #ruby
[05:35:09] sauvin: has joined #ruby
[05:41:43] sagax: how to expand array? [1,2,3] to get 1, 2, 3
[05:41:54] sagax: some like as *[1,2,3]
[05:45:16] sagax: oh, nothing, i another problem
[05:45:19] havenwood: sagax: Hrm?
[05:46:13] havenwood: sagax: a splat like you showed would turn the Array into three arguments
[05:46:37] havenwood: Ruby doesn't have multiple return values
[05:59:10] eckhardt: has joined #ruby
[06:01:26] tlarevo: has joined #ruby
[06:07:54] schleppel: has joined #ruby
[06:12:02] eckhardt: has joined #ruby
[06:14:13] claudiuinberlin: has joined #ruby
[06:19:53] sagax: why `Set` can't convert to json?
[06:20:57] sagax: i must cast `Set` to `Array` and after cast `Array` to `json`
[06:21:02] sagax: but it's strange
[06:21:45] jenrzzz: has joined #ruby
[06:30:16] ytti: to me it makes sense
[06:30:34] ytti: there is no set in json, so you couldn't read anything back to set either
[06:31:06] ytti: casting it to array makes things more self-documenting
[06:39:08] mkaito: has joined #ruby
[06:39:08] mkaito: has joined #ruby
[06:46:50] andikr: has joined #ruby
[06:49:33] havenwood: sagax: Vanilla JSON doesn't support Set. That said, Ruby JSON actually does have optional support for Set.
[06:49:59] havenwood: sagax: require 'json/add/set'
[06:50:30] havenwood: https://github.com/ruby/ruby/blob/d48783bb0236db505fe1205d1d9822309de53a36/ext/json/lib/json/add/set.rb
[06:50:56] planigan: has joined #ruby
[06:51:43] 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.
[06:52:55] ytti: how does it look whe nserialised? !ruby/set ...?
[06:53:18] havenwood: ytti: "{\"json_class\":\"Set\",\"a\":[]}"
[06:53:31] havenwood: That's ^ an empty Set.
[06:53:35] ytti: havenwood, ok
[06:53:52] ytti: at that point, personally i'd look into other serailisation formats
[06:54:00] ytti: which offer transferable set support
[06:54:22] havenwood: &>> require 'json/add/set'; Set.new([1, 2, 3]).to_json
[06:54:24] rubydoc: # => cannot load such file -- json/add/set (LoadError) stderr:... check link for more (https://carc.in/#/r/6qso)
[06:54:43] havenwood: phaul: ^ hmmm
[06:55:05] havenwood: #=> "{\"json_class\":\"Set\",\"a\":[1,2,3]}"
[06:56:05] ytti: hmm protobuf doesn't support set either
[06:56:27] havenwood: "there is no plan to add a set type in protobuf"
[06:56:57] reber: has joined #ruby
[06:57:04] ytti: capnproto neither
[06:59:32] ytti: avro neither, well set seems surprisingly rare
[06:59:50] havenwood: ytti: I'd vote YAML with #safe_load and Set added to whitelist classes
[06:59:58] havenwood: &>> require 'psych'; Psych.safe_load "--- !ruby/object:Set\nhash: {}\n", [Set]
[07:00:00] rubydoc: # => uninitialized constant Set (NameError) stderr: -e:2:in `<main>': uninitialized constant Set (NameError) (https://carc.in/#/r/6qsp)
[07:00:09] havenwood: &>> require 'set'; require 'psych'; Psych.safe_load "--- !ruby/object:Set\nhash: {}\n", [Set]
[07:00:10] rubydoc: # => #<Set: {}> (https://carc.in/#/r/6qsq)
[07:00:42] ytti: messagepack doesn't have set either
[07:02:29] ytti: thrift has set
[07:04:55] _joes_: has joined #ruby
[07:05:00] d^sh: has joined #ruby
[07:05:09] ytti: i would probably just use list and write in api specification that it should not contain duplicates :/
[07:05:23] ytti: and behaviour for list with duplicates is unspecified
[07:10:27] TomyLobo: has joined #ruby
[07:15:07] clemens3_: has joined #ruby
[07:15:26] lxsameer: has joined #ruby
[07:17:18] alem0lars: has joined #ruby
[07:21:01] eph^: has joined #ruby
[07:22:11] aupadhye: has joined #ruby
[07:23:05] BH23: has joined #ruby
[07:24:53] Dbugger: has joined #ruby
[07:33:43] TomyLobo: has joined #ruby
[07:33:48] ramfjord: has joined #ruby
[07:36:40] planigan: has joined #ruby
[07:43:18] mkaito_: has joined #ruby
[07:47:22] cedum: has joined #ruby
[07:51:01] TomyLobo: has joined #ruby
[08:08:22] esrse: has joined #ruby
[08:19:20] hightower2: has joined #ruby
[08:23:35] dionysus69: has joined #ruby
[08:26:58] jefffrails35: has joined #ruby
[08:31:43] iMadper: has joined #ruby
[08:31:57] Jonopoly: has joined #ruby
[08:32:09] mangold: has joined #ruby
[08:32:23] Jonopoly: Morning everyone
[08:32:44] Jonopoly: Anyone got any advice on automating a stress test using Ruby
[08:32:51] Jonopoly: Website is Java/React
[08:33:05] TomyLobo: has joined #ruby
[08:39:37] ojbfe7: has joined #ruby
[08:41:47] jottr: has joined #ruby
[08:48:35] lxsameer: has joined #ruby
[08:54:00] kyrylo: has joined #ruby
[08:57:59] lxsameer: has joined #ruby
[09:00:43] jenrzzz: has joined #ruby
[09:02:58] jordanm: Jonopoly: apachebench for basic stuff, gatling for more complex load testing
[09:03:21] jordanm: neither use ruby, not sure why you need ruby specifically
[09:11:37] Jonopoly: Well atm we use ruby and selemiun
[09:11:58] Jonopoly: Language is easy for non-developers to follow
[09:12:51] Jonopoly: Like python has locustio
[09:13:54] marz_d`ghostman: has joined #ruby
[09:14:10] marz_d`ghostman: I have a string with \n in it. How do I get erb to parse that and display a new line?
[09:18:21] dionysus69: has joined #ruby
[09:20:49] tlarevo: has joined #ruby
[09:27:14] Nicmavr: has joined #ruby
[09:33:58] ramfjord: has joined #ruby
[09:41:16] gregf_: has joined #ruby
[09:41:28] reber__: has joined #ruby
[09:45:21] meruem: has joined #ruby
[09:52:16] dsmythe: has joined #ruby
[10:11:53] _joes_: has joined #ruby
[10:12:01] BH23: has joined #ruby
[10:19:32] DmitryBochkarev: has joined #ruby
[10:22:31] za1b1tsu: has joined #ruby
[10:34:37] sina: has joined #ruby
[10:44:00] sphenxes: has joined #ruby
[10:45:02] AJA4350: has joined #ruby
[10:56:34] Jonopoly: has joined #ruby
[11:04:20] jenrzzz: has joined #ruby
[11:09:39] schne1der: has joined #ruby
[11:34:15] ramfjord: has joined #ruby
[11:35:06] agent_white: has joined #ruby
[11:40:06] laaron: has joined #ruby
[11:43:17] wald0: has joined #ruby
[11:52:06] ldnunes: has joined #ruby
[11:57:07] _joes_: has joined #ruby
[11:57:15] BH23: has joined #ruby
[12:01:42] kapil____: has joined #ruby
[12:07:25] 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
[12:09:04] liuyiwen: has joined #ruby
[12:09:11] dostoyevsky: > /usr/local/lib/ruby/2.5/irb/ruby-lex.rb:721:in `block in lex_int2': invalid byte sequence in UTF-8 (ArgumentError)
[12:09:20] liuyiwen: has left #ruby: ()
[12:13:05] Jonopoly: has joined #ruby
[12:15:32] phaul: dostoyevsky: do you have an UTF-8 locale?
[12:16:23] phaul: cat /etc/locale.conf => LANG=en_GB.UTF-8
[12:17:03] dostoyevsky: phaul: LC_CTYPE=en_US.UTF-8
[12:17:16] dostoyevsky: but a German keyboard...
[12:17:42] dostoyevsky: And readline in irb requires two backspace to delete ≠
[12:17:57] dostoyevsky: if I only do one backspace, then I will get that UTF-8 error
[12:18:14] dostoyevsky: I tried irb -E UTF-8:UTF-8 and -U but it didn't help
[12:19:29] phaul: requires two backspace: I'm not sure if this is to do with the terminal you are in
[12:19:41] mangold: has joined #ruby
[12:20:57] phaul: fwiw I can delete ≠ with one keystroke in both irb and just in the shell. (termite terminal)
[12:21:06] dostoyevsky: hmmm... I just tried python and there ≠ also requires two backspace to be deleted...
[12:21:47] dostoyevsky: hmmmm... also works on my linux box...
[12:22:05] dostoyevsky: but not on the openbsd box...
[12:29:11] kyrylo: has joined #ruby
[12:34:41] mangold: has joined #ruby
[12:35:50] tdy1: has joined #ruby
[12:38:09] waronline00001: has joined #ruby
[12:41:57] Silex: has joined #ruby
[12:46:53] catbusters: has joined #ruby
[12:49:09] ldnunes: has joined #ruby
[12:50:49] SuperL4g_: has joined #ruby
[12:51:05] Sup3rLurk: has joined #ruby
[13:01:47] helpa: has joined #ruby
[13:02:02] helpa: has joined #ruby
[13:02:36] dsmythe: has joined #ruby
[13:03:44] al2o3-cr: has joined #ruby
[13:04:39] jenrzzz: has joined #ruby
[13:05:44] Voxxit: has joined #ruby
[13:08:54] ljarvis__: has joined #ruby
[13:09:40] fluxAeon: has joined #ruby
[13:25:02] claudiuinberlin: has joined #ruby
[13:29:49] Azure: has joined #ruby
[13:36:14] claudiuinberlin: has joined #ruby
[13:40:48] jelera: has joined #ruby
[13:41:46] schne1der: has joined #ruby
[13:45:51] laaron: has joined #ruby
[13:50:31] Rudd0^: has joined #ruby
[13:56:23] jelera: has joined #ruby
[13:58:47] SeepingN: has joined #ruby
[13:59:10] Mia: has joined #ruby
[13:59:11] Mia: has joined #ruby
[14:00:08] fanta1: has joined #ruby
[14:00:58] laaron: has joined #ruby
[14:10:35] krawchyk: has joined #ruby
[14:17:57] nowhereman: has joined #ruby
[14:21:10] Swyper: has joined #ruby
[14:29:26] lord4163: has joined #ruby
[14:35:24] zeroquake: has joined #ruby
[14:43:39] Inline: has joined #ruby
[14:43:58] mangold: has joined #ruby
[14:44:50] Swyper: has joined #ruby
[14:48:35] lucasb: has joined #ruby
[14:49:53] GodFather: has joined #ruby
[14:52:04] RedNifre: has joined #ruby
[14:52:40] 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?
[14:53:07] RedNifre: (It's for compiling basic programs for my old calculator that is programmed in something that feels like machine language)
[14:53:32] ellcs: has joined #ruby
[14:56:53] jelera: has joined #ruby
[14:58:55] pupsikov: has joined #ruby
[15:05:08] mangold: has joined #ruby
[15:13:09] Dbugger: has joined #ruby
[15:15:30] agent_white: has joined #ruby
[15:20:01] s2013: has joined #ruby
[15:20:05] Mia: has joined #ruby
[15:20:05] Mia: has joined #ruby
[15:22:54] Swyper: has joined #ruby
[15:28:17] UnknownSoldier: has joined #ruby
[15:33:17] houhoulis: has joined #ruby
[15:37:42] suukim: has joined #ruby
[15:37:54] zeroquake: has joined #ruby
[15:39:12] polishdub: has joined #ruby
[15:43:31] dsmythe: has joined #ruby
[15:47:10] jxpond: has joined #ruby
[15:48:06] jxpond: has left #ruby: ()
[15:48:12] duderonomy: has joined #ruby
[15:49:46] jottr: has joined #ruby
[15:50:36] millerti: has joined #ruby
[16:09:38] zeroquake: has joined #ruby
[16:10:03] phaul: RedNifre: for lexer/tokenization there is stdlib StringScanner.
[16:10:38] phaul: for parsing I have used parslet in the past, but there is also whittle
[16:11:39] phaul: I don't think you need an explicit tokenization for either, you just use regexps for your terminals
[16:14:16] RedNifre: has joined #ruby
[16:22:08] rippa: has joined #ruby
[16:22:38] jenrzzz: has joined #ruby
[16:36:48] duderonomy: has joined #ruby
[16:38:52] iMadper: has joined #ruby
[16:39:31] Stimpy_: has joined #ruby
[16:39:42] stimpy__: has joined #ruby
[16:50:32] Stimpy_: has joined #ruby
[16:51:30] zachk: has joined #ruby
[16:52:53] xco: has joined #ruby
[16:53:00] zachk: has joined #ruby
[16:53:06] xco: hello! it’s me again :P
[16:53:11] xco: i’m in IRB
[16:53:27] xco: how can i be sure i’m encoding strings the way i want
[16:53:31] xco: this is what i’m trying
[16:53:49] xco: str.encode("UTF-8")
[16:53:50] ByronJohnson: has joined #ruby
[16:53:54] Ropeney: has joined #ruby
[16:53:57] xco: where ‘str’ = “some string"
[16:54:23] xco: but i’m not sure it’s working because i’m working on a string that looks like this
[16:54:37] xco: str = “noël”
[16:55:00] RedNifre: looks like french?
[16:55:04] xco: when i do str.length i get 5. which is weird
[16:55:17] zachk: has joined #ruby
[16:55:18] xco: i don’t know what language “noël” is hahahahha
[16:55:22] xco: i’m just playing with it
[16:55:54] xco: but i doubt french has that kind of “e”. IDK :P
[16:55:56] 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.
[16:56:07] xco: ah right, fuck it :P
[16:56:13] RedNifre: it means you pronounce it "no-el"
[16:56:22] RedNifre: like "naive" with two dots on the i
[16:56:32] sameerynho: has joined #ruby
[16:57:01] 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?
[16:57:06] xco: correctly*
[16:57:18] 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.
[16:57:21] xco: it’s weird to see “noël” as length of 5 in Ruby
[16:57:49] 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.
[16:58:09] xco: you just blew my mind hahaha
[16:58:18] RedNifre: MacOS will store it as "noe<dots on the previous character>l" kinda.
[16:58:31] SeepingN_: has joined #ruby
[16:58:53] 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.
[16:59:01] RedNifre: Text is tricky :)
[16:59:01] ByronJohnson: has joined #ruby
[16:59:14] xco: i’m doing all this in irb
[16:59:44] RedNifre: Looks like nobody knows how to do it: https://unicode-programming.readthedocs.io/en/latest/count-characters/ruby/
[16:59:56] xco: Elixir conveniently provides byte_size(str) and String.length(str) so i thought there’d be something similar in Ruby
[17:00:26] RedNifre: I only know about Swift counting grapheme clusters correctly, I hope more languages will offer that feature in the future.
[17:01:20] 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.
[17:01:50] xco: this is rocket science
[17:01:55] xco: at least to me
[17:02:04] xco: and weird at the same time
[17:02:09] xco: a lot of languages have this
[17:02:23] xco: and Ruby’s community is big enough to have it too. if no one does it i’ll fix this! :P
[17:02:30] xco: give me a year
[17:02:49] xco: 6months tops, first i have to learn unicode
[17:02:54] RedNifre: Your string would fit into ISO/IEC 8859-15, so convert it to that to get a 4 byte string ;)
[17:03:17] RedNifre: (That's a really bad idea and was meant as a joke)
[17:03:36] xco: oh really? why would it be a bad idea?
[17:05:03] RedNifre: Because then you couldn't mix it with Japanese or Russian text any more. It wouldn't be Unicode.
[17:05:24] RedNifre: If you want to count the grapheme characters correctly here's how: http://www.unicode.org/reports/tr29/
[17:06:08] xco: all this while i thought Date/Time was the most complicated, i’m adding Strings to that list
[17:06:20] xco: btw in irb i’m doing something like this
[17:06:20] krawchyk: has joined #ruby
[17:06:26] xco: str.encode("ISO-8859-1")
[17:06:39] xco: not sure if it makes sense, prolly doesn’t because i’m getting back
[17:06:39] RedNifre: That's even worse, that doesn't even have the EUR sign.
[17:06:45] xco: Encoding::UndefinedConversionError (U+0308 from UTF-8 to ISO-8859-1)
[17:07:53] RedNifre: You have a U+0308 in there?
[17:08:01] xco: interesting thread here https://stackoverflow.com/questions/13003287/encodingundefinedconversionerror
[17:08:15] RedNifre: Then 5 is the correct code point length, because your string is actually "noe<dots on previous char>l"
[17:08:48] RedNifre: Try the length of this in IRB (Copy paste it!) "noël"
[17:09:21] xco: what the hell?!?!? hahahhaa
[17:09:27] RedNifre: Yeah, so it does in fact count the unicode code points.
[17:10:02] RedNifre: With your string, do s[2] to get "e" and s[3] to get the dots.
[17:10:28] RedNifre: With my string, s[2] should give you the single character "e with dots"
[17:11:00] xco: where did you get "noël" from? it acting differently from my "noël”!!
[17:13:00] 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.
[17:13:31] xco: ah i see!
[17:13:46] xco: this is interesting
[17:14:17] xco: to the eye this is very confusing to someone who doesn’t know what’s going on under cover https://gyazo.com/cfe70707fe809fe51bbd9df8f7d79eb8
[17:14:33] xco: thanks for the enlightenment!
[17:15:15] RedNifre: Even more fun: Those two strings are identical according to Unicode.
[17:15:29] xco: got some reference online?
[17:15:53] 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.
[17:16:04] RedNifre: Well, unicode.org? Or just some random stuff.
[17:16:14] RedNifre: I mostly learn Unicode when something doesn't work as expected ;)
[17:16:38] RedNifre: Hey, do you have Emoji in your IRB?
[17:16:40] xco: i guess strings and encodings are a whole new subject to be studies carefuly
[17:17:28] RedNifre: Which country are you from and do you have Emoji-Support in your IRB? :D
[17:18:05] go|dfish: has joined #ruby
[17:18:54] RedNifre: Dammit, looks like Ubuntu doesn't do flags in the terminal.
[17:19:14] RedNifre: If you are on MacOS you could try reversing "🇺🇸🇪🇪" (USA flag followed by Estland Flag).
[17:20:39] 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).
[17:21:29] ytti: indeed in UTF8 ë can be 1 or 2 runes
[17:21:44] ytti: there is specific rune for it, but you can also compose it from two runes
[17:21:49] ytti: they will be rendered exactly the same
[17:22:12] ytti: and this leads to all kind of consufing behaviour
[17:24:27] duderonomy: has joined #ruby
[17:25:50] RedNifre: Yeah, dealing with Unicode can lead to a lot of 🐛🐞 if you are not careful.
[17:27:56] ytti: https://en.wikipedia.org/wiki/Unicode_equivalence
[17:28:40] ytti: macOS uses fully decomposed umlauts when creating screenshot name in international versions
[17:28:46] ytti: which i've never seen used anywhere else
[17:29:12] ytti: where as all users of those languages use exclusively fully composed versions
[17:29:27] ytti: further, differnt shells and tools interepret them as different or same
[17:29:41] ytti: so you may end up in siitaution where you have same file twice in fielsystem, but some tools will only see it once
[17:30:16] ytti: also renaming and overwriting may happen, as some tools implicitly convert to fully composed format
[17:35:35] mangold: has joined #ruby
[17:37:14] cedum: has joined #ruby
[17:42:10] nowhere_man: has joined #ruby
[17:48:55] dellavg_: has joined #ruby
[17:49:14] Swyper: has joined #ruby
[17:59:25] duderonomy: has joined #ruby
[17:59:37] zeroquake: has joined #ruby
[18:00:31] Azure: has joined #ruby
[18:03:07] krawchyk: has joined #ruby
[18:05:56] Cthulu201: has joined #ruby
[18:17:56] powerbit: has joined #ruby
[18:22:03] duderonomy: has joined #ruby
[18:25:07] claudiuinberlin: has joined #ruby
[18:27:53] ramfjord: has joined #ruby
[18:40:25] shalok: Is it possible to assign a variable to the output of a case statement?
[18:40:34] shalok: something like: x = case my_string; when /asdf/ then 123; when /zxcv/ then 456; else 789; end
[18:41:19] lupine: yeah, that works fine
[18:41:26] lupine: everything in ruby is an expression
[18:42:13] shalok: lupine: Well irb doesn't report an error, but x doesn't seem to have a value after I execute ^
[18:43:47] shalok: I somehow ended up inside a state and had to type `end` a few times =/
[18:44:01] shalok: that's why I wasn't getting any output. oops =)
[18:44:25] lupine: ctrl+c will get you out of most irb-related fails
[18:44:28] shalok: yeah it works great, thanks
[18:44:49] lupine: related to case - anyone seen the upcoming ` case...in` pattern-matching thing?
[18:46:30] tAn: has joined #ruby
[18:57:26] tdy1: has joined #ruby
[19:07:48] claudiuinberlin: has joined #ruby
[19:12:51] meruem: has joined #ruby
[19:13:20] duderonomy: has joined #ruby
[19:15:38] schleppel: has left #ruby: ("Konversation terminated!")
[19:18:50] AJA4351: has joined #ruby
[19:19:23] reber: has joined #ruby
[19:22:07] cedum: has joined #ruby
[19:31:23] ramfjord: has joined #ruby
[19:32:03] aert: has joined #ruby
[19:40:23] baweaver: lupine: yep, I wrote the articles on it: https://medium.com/@baweaver/ruby-2-7-pattern-matching-first-impressions-cdb93c6246e6
[19:40:46] hightower2: has joined #ruby
[19:47:26] maryo: has joined #ruby
[19:49:29] za1b1tsu: has joined #ruby
[19:58:08] Mia: has joined #ruby
[19:58:08] Mia: has joined #ruby
[20:00:10] jcarl43: has joined #ruby
[20:05:05] ldnunes: has joined #ruby
[20:12:36] lupine: baweaver: does it make your spine crawl as much as mine? ^^
[20:20:01] remi: has joined #ruby
[20:24:08] ldnunes: has joined #ruby
[20:32:23] duderonomy: has joined #ruby
[20:32:41] maryo_: has joined #ruby
[20:32:47] maryo__: has joined #ruby
[20:33:23] aert: has joined #ruby
[20:35:30] dsmythe: has joined #ruby
[20:35:52] Swyper: has joined #ruby
[20:37:28] kapil____: has joined #ruby
[20:37:58] duderonomy: has joined #ruby
[20:39:19] UnknownSoldier: has joined #ruby
[20:41:45] evdubs_: has joined #ruby
[20:43:02] aert: has joined #ruby
[20:55:48] ramfjord: has joined #ruby
[20:55:53] aert: has joined #ruby
[20:58:16] aert: has joined #ruby
[20:59:11] aert: has joined #ruby
[21:00:03] Swyper: has joined #ruby
[21:00:11] Mia: has joined #ruby
[21:00:11] Mia: has joined #ruby
[21:01:58] Azure: has joined #ruby
[21:02:36] zeroquake: has joined #ruby
[21:03:58] RiPuk: has joined #ruby
[21:04:08] evdubs__: has joined #ruby
[21:06:07] Fernando-Basso: has joined #ruby
[21:08:15] evdubs_: has joined #ruby
[21:10:53] maryo: has joined #ruby
[21:27:34] dsmythe_: has joined #ruby
[21:29:00] fluxAeon: has joined #ruby
[21:30:56] dsmythe__: has joined #ruby
[21:50:31] IGnorAND: is !empty? considered better than .length > 0
[22:01:46] phaul: in general asking objects from outside and let them do stuff inside is better. Here I think it's obrderline cargo culting
[22:01:56] phaul: borderline
[22:02:59] phaul: still fewer characters and somewhat more expressive code
[22:06:31] phaul: but nothing really wrong with either
[22:08:05] dsmythe: has joined #ruby
[22:08:07] mikeiniowa: has joined #ruby
[22:11:19] SirFunk: has joined #ruby
[22:16:15] RiPuk: has joined #ruby
[22:16:32] 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.
[22:16:41] evdubs: has joined #ruby
[22:16:57] IGnorAND: Anyone know how to refactor this: https://gist.github.com/nuheluxulu/dd89a5551b2071795b663137ae3a8f10 I did the rescue to place default values
[22:18:08] Swyper: has joined #ruby
[22:18:23] IGnorAND: would I have to write a private attr_writer for the arguments?
[22:18:44] aert: has joined #ruby
[22:20:12] phaul: line 9-13 are the same as line 14-18?
[22:22:01] phaul: is thata typo or intended?
[22:23:18] IGnorAND: phaul: typo.
[22:23:38] IGnorAND: 14-18 can be deleted
[22:24:01] 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
[22:25:18] aert: has joined #ruby
[22:26:33] aerth: has joined #ruby
[22:27:13] IGnorAND: meh, that doesnt even work :(
[22:27:13] aert: has joined #ruby
[22:27:43] phaul: if one line is the goal you can suffix rescue. but I don't like that way either
[22:27:56] phaul: &>> raise 'hell' rescue 1666
[22:27:59] rubydoc: # => 1666 (https://carc.in/#/r/6qyt)
[22:28:31] IGnorAND: phaul: that's the code I had before
[22:28:49] IGnorAND: &>> @page = Integer(opts[:page]) rescue 1
[22:28:50] rubydoc: # => 1 (https://carc.in/#/r/6qyu)
[22:29:37] phaul: when can opts return something that Integer fails on? Is this just nil check?
[22:29:50] phaul: if so maybe use Hash#fetch on opts
[22:29:56] phaul: with default
[22:30:14] IGnorAND: phaul: Integer("seven") would fail
[22:30:28] phaul: and that can be in opts.. bummer
[22:31:49] IGnorAND: can I do set_page(opts[:page]) and do a def set_page(page_number) with the begin rescue etc there?
[22:32:57] noboruma: has joined #ruby
[22:33:11] 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
[22:36:23] 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
[22:36:37] phaul: and should really send good data
[22:39:10] terabytes: has joined #ruby
[22:39:18] phaul: so depending on where the initialize can be called from, maybe the right refactor is to get rid of error checking full stop
[22:42:02] Swyper: has joined #ruby
[22:45:47] IGnorAND: I was thinking of doing that as well, but then again stop errors as soon as possible?
[22:46:34] phaul: exactly. not even here further up where opts is assembled
[22:46:54] shalok: So I know this is horrible, but is there any way to check the number of arguments that a method expects?
[22:47:40] phaul: IGnorAND: then you don't even call Thisclass.new if you don't have data it can work with.
[22:48:24] phaul: It's find to have Thisclass.can_you_accept?(opts) method if you want the logic in the class
[22:48:40] phaul: still no exception
[22:48:49] leftylink: &ri Method#parameters might be what shalok wants?
[22:48:50] rubydoc: https://ruby-doc.org/core-2.6/Method.html#method-i-parameters, might be what shalok wants?
[22:49:25] phaul: s/find/fine/
[22:49:43] IGnorAND: @shalok "".method(:is_a?).arity
[22:51:21] phaul: idea is to push errors out all the way to where the data comes in
[22:51:57] IGnorAND: &ri Method#arity might be what interesting
[22:51:57] rubydoc: https://ruby-doc.org/core-2.6/Method.html#method-i-arity, might be what interesting
[22:52:18] IGnorAND: phaul: I suppose
[22:57:36] Azure: has joined #ruby
[23:09:43] uplime34: has joined #ruby
[23:29:25] AJA4351: has joined #ruby
[23:34:04] galaxie: has joined #ruby