« Back to channel list

#ruby - 05 March 2019

« Back 1 day Forward 1 day »
[00:11:09] mahlon: has joined #ruby
[00:11:49] rprimus: has joined #ruby
[00:12:25] tbuehlmann: has joined #ruby
[00:15:25] conta: has joined #ruby
[00:29:58] mangold: has joined #ruby
[00:38:59] helpa: has joined #ruby
[00:44:19] laaron: has joined #ruby
[00:52:55] bjpenn: has joined #ruby
[00:55:20] bjpenn: i have this function that calls aws for some configuration, but once it actually gets those parameters, i want it to store it in a variable and never actually make an https api call to obtain them again. Not sure if i should use a global constant in my rb file to store it
[00:56:08] bjpenn: is this what modules are for in ruby?
[01:00:28] bjpenn: basically i have a variable that i want accessed by multiple methods
[01:00:50] bjpenn: without classes i can only use consts for that variable right?
[01:04:02] elphe: has joined #ruby
[01:05:53] orbyt_: has joined #ruby
[01:07:27] Eiam: you could just put them in a struct
[01:07:46] bjpenn: ah ok... let me look up how that works
[01:07:54] bjpenn: im new to ruby
[01:08:13] Eiam: modules are for namespacing and mixins
[01:10:06] bjpenn: so if i create a struct, it would be in the global namespace?
[01:10:20] bmurt: has joined #ruby
[01:10:50] bjpenn: https://www.leighhalliday.com/ruby-struct
[01:10:54] bjpenn: looking at this link here...
[01:12:03] bjpenn: basically i would declare a "Credentials" struct, for example... which would have a 'username' and a 'password' field
[01:12:12] Eiam: its namespaced where you create it
[01:12:29] Eiam: if you put it in a module, then its in the module. in a class then its in the class. in a block then its in the block
[01:12:53] bjpenn: my script doesnt include modules so it would just be global scope i guess
[01:13:16] Eiam: if this is just a single .rb trying to poke at some problem that doesn't seem 'bad'
[01:13:30] Eiam: I do it all the time but I could be the worst programmer in the world =)
[01:13:57] bjpenn: yeah this is just a single .rb
[01:14:26] bjpenn: i guess ill try and get it to work with struct and see how it goes
[01:15:16] mangold: has joined #ruby
[01:17:18] bjpenn: my whole script is executed within a method called "execute"
[01:17:38] bjpenn: i cant really create teh struct in there because then it would only be scoped to that definition
[01:17:43] bjpenn: and i dont want to pass that struct everywhere
[01:17:52] bjpenn: what other options do i have?
[01:21:17] SanguineAnomaly: has joined #ruby
[01:23:51] elphe: has joined #ruby
[01:25:46] Eiam: declare it at the top? =)
[01:27:24] SanguineAnomaly: has joined #ruby
[01:28:33] bjpenn: is this bad style
[01:29:13] Eiam: uhmm. I personally prefer to write code that solves the problem I'm trying to solve then worry about how the style fits and what problems I had/didn't have with it, especially if its just a throw away script
[01:29:28] bjpenn: def api_creds $global_var ||= expensive_rest_call_to_get_creds()
[01:29:57] bjpenn: def api_creds() $global_var ||= expensive_rest_call_to_get_creds(); end
[01:30:05] bjpenn: maybe thats the more correct way to do a oneliner
[01:30:45] Eiam: why are you forcing this to one line? is there some kind of quota on newlines?
[01:31:03] bjpenn: oh im just trying to show what im doing without pasting multiple lines
[01:31:10] bjpenn: the focus is not that its using one line, its that its using a global var
[01:31:18] bjpenn: to store something
[01:31:31] Eiam: ah, you can use https://dpaste.de for easy formatting too
[01:32:05] bjpenn: so everytime i want to retrieve the credentials, it will just reference api_creds()... if i do it this way, then it will only execute the expensive_rest_call_to_get_creds() method once right?
[01:32:18] bjpenn: every subsequent time i call api_creds() it will just return $global_var right?
[01:35:21] APK: has joined #ruby
[01:36:25] Eiam: depends on what expensive_rest_call_to_get_creds() returns
[01:36:48] bjpenn: thats supposed to return the credentials
[01:37:11] bjpenn: lets say like {'username': foo', 'password':'bar'}
[01:37:15] Eiam: if it returns false, it could change on subsequent calls
[01:37:37] Eiam: otherwise yes it should do what you want
[01:37:54] bjpenn: if expensive_rest_call_to_get_creds() returns false
[01:38:07] bjpenn: then $global_var would never get set right?
[01:38:20] bjpenn: or it would get set to false?
[01:38:48] Eiam: a ||= b is "a || b"
[01:38:53] Eiam: yes, it would be set to false
[01:39:01] Eiam: >> a ||= false
[01:39:06] ruby[bot]: Eiam: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
[01:39:16] Eiam: uh works in irb
[01:39:21] Eiam: ACTION pokes ruby[bot] 
[01:39:50] Eiam: a = a || b rather, omitted the first part =)
[01:40:14] Eiam: bjpenn: it would go from 'nil' to 'false' which isn't quite the same thing. probably doesn't matter
[01:40:28] Eiam: until its 2am and your code isn't working
[01:42:09] bjpenn: thats what im afraid of :)
[01:43:00] bjpenn: i get i can make sure expensive_rest_call() returns nil in the failure condition right?
[01:43:22] bjpenn: if it does return nil though, then api_creds() would return false?
[01:43:43] bjpenn: or just return nil?
[01:44:05] bjpenn: i think probably just nil right?
[01:44:10] iNs: has joined #ruby
[01:47:33] bjpenn: testing :)
[02:18:58] evdubs: has joined #ruby
[02:19:46] Onwarion: has joined #ruby
[02:44:32] agent_white: has joined #ruby
[03:01:12] iNs: has joined #ruby
[03:01:50] Tempesta: has joined #ruby
[03:20:55] ua: has joined #ruby
[03:26:31] laaron: has joined #ruby
[04:00:14] sonander: has joined #ruby
[04:02:39] tdy: has joined #ruby
[04:09:49] braincrash: has joined #ruby
[04:37:12] v01d4lph4: has joined #ruby
[04:41:51] spacesuitdiver: has joined #ruby
[05:03:14] kapil____: has joined #ruby
[05:03:40] Xiti: has joined #ruby
[05:05:39] dviola: has joined #ruby
[05:15:46] ur5us: has joined #ruby
[05:35:52] elphe: has joined #ruby
[05:39:30] mangold: has joined #ruby
[06:06:02] bga57: has joined #ruby
[06:19:06] mangold: has joined #ruby
[06:21:29] conta: has joined #ruby
[06:22:08] fluxAeon: has joined #ruby
[06:42:10] Rudd0: has joined #ruby
[06:46:57] mangold: has joined #ruby
[07:00:27] Pisuke: has joined #ruby
[07:00:46] aupadhye: has joined #ruby
[07:09:04] iMadper: has joined #ruby
[07:09:08] za1b1tsu: has joined #ruby
[07:11:03] sgen: has joined #ruby
[07:17:42] reber: has joined #ruby
[07:22:18] elphe: has joined #ruby
[07:30:17] pskosinski: has joined #ruby
[07:45:24] LightStalker: has joined #ruby
[07:47:44] mangold: has joined #ruby
[08:12:58] Leifr: has joined #ruby
[08:14:55] clemens3_: has joined #ruby
[08:16:44] aufi: has joined #ruby
[09:12:52] elphe: has joined #ruby
[09:14:44] t0x: has joined #ruby
[09:29:46] elphe: has joined #ruby
[09:33:36] Sembei: has joined #ruby
[09:38:12] lxsameer: has joined #ruby
[09:45:30] sgen: has joined #ruby
[09:48:59] tdy: has joined #ruby
[09:58:18] sgen: has joined #ruby
[10:12:11] vonfry: has joined #ruby
[10:21:07] apparition: has joined #ruby
[10:25:46] ryouba: has joined #ruby
[10:28:09] DTZUZO: has joined #ruby
[10:28:38] ellcs: has joined #ruby
[10:44:45] tdy: has joined #ruby
[10:49:39] dionysus70: has joined #ruby
[10:54:10] _whitelogger: has joined #ruby
[10:55:15] ryouba: is there a way to make "comment_xls".gsub(/(.*)_(.*)/, '\2'.upcase+' \1') do what i thought it would do (i.e. return "XLS comment")?
[10:55:50] ryouba: how, Radar? :)
[10:55:56] Radar: first question is free
[10:56:06] Radar: second question, also free
[10:56:22] ryouba: ACTION gets a parcel and puts a mug with coffee in it for Radar
[10:57:03] Radar: I would do it like this: "comment_xls".gsub(/(.*)_(.*)/) { "#{$2.upcase} #{$1}" }
[10:57:19] Radar: The block is evaluated once the gsub does its thing
[10:57:26] ryouba: oh, it also takes a block!
[10:58:03] ryouba: and what's the difference between \n and $n?
[11:00:00] Radar: I am not entirely sure.
[11:00:06] ryouba: perhaps there is none
[11:00:27] rubydoc: has joined #ruby
[11:01:30] helpa: has joined #ruby
[11:01:55] Radar: $1, $2 and so on are special global variables available after a regex match
[11:02:57] ryouba: curious, somewhere i must have picked up the \n notation, apparently not in the context of ruby
[11:05:04] phaul: backreferences are also in ruby
[11:08:04] phaul: &>> "comment_xls".gsub(/(.*)_(.*)/, '\2 \1')
[11:08:05] rubydoc: # => "xls comment" (https://carc.in/#/r/6f5g)
[11:08:21] phaul: problem is how you put the upcase on it
[11:08:22] ryouba: oh that's even a little shorter
[11:08:44] phaul: '\2'.upcase is just '\2' :)
[11:08:48] ryouba: ACTION tries to stuff a fresh EEPROM into his brain to retain all that info
[11:09:33] Radar: &>> "comment_xls".gsub(/(.*)_(.*)/, '\2 \1').gsub("xls", "XLS")
[11:09:34] rubydoc: # => "XLS comment" (https://carc.in/#/r/6f5h)
[11:09:38] Radar: next question plz
[11:11:08] conta: has joined #ruby
[11:13:41] ryouba: Radar: sorry, for now i'm out of questions :-P
[11:13:56] Radar: ryouba: that's okay. I am out of energy. I will sleep now. See you tomorrow.
[11:14:05] ryouba: sleep well!
[11:42:40] Paraxial: has joined #ruby
[11:54:36] elphe: has joined #ruby
[12:00:26] jdawgaz: has joined #ruby
[12:00:52] Fernando-Basso: has joined #ruby
[12:08:50] AJA4350: has joined #ruby
[12:08:54] lucasb: has joined #ruby
[12:09:07] tdy: has joined #ruby
[12:13:00] Tharbakim: has joined #ruby
[12:17:05] tdy: has joined #ruby
[12:25:07] Nicmavr: has joined #ruby
[12:31:11] Tharbakim: has joined #ruby
[12:33:42] pskosinski: has joined #ruby
[12:39:34] jane_booty_doe: has joined #ruby
[12:51:18] bmurt: has joined #ruby
[12:59:14] stryek: has joined #ruby
[13:02:27] elphe: has joined #ruby
[13:05:28] michael_mbp: has joined #ruby
[13:35:45] za1b1tsu: has joined #ruby
[13:43:25] tuor: has joined #ruby
[13:56:57] ryouba: hey that would be an interesting idea
[13:57:32] ryouba: is it possible to tell ruby: "for the currently executing script, once you enter any method, puts(__method__) before you start executing the method's contents"?
[14:02:41] phaul: &ri TracePoint
[14:02:41] rubydoc: https://ruby-doc.org/core-2.6/TracePoint.html
[14:02:51] phaul: ryouba: ^
[14:04:50] ryouba: ACTION tries
[14:09:03] saysjonathan: has joined #ruby
[14:09:10] mangold: has joined #ruby
[14:12:27] ryouba: phaul: okay, so TracePoint uses set_trace_func, which has, as one of its proc parameters, "binding". i'm assuming through that binding i'll be able to get the name of the method that was called - but how?
[14:19:08] ryouba: another question: is it permissible to have variables whose name starts with a sigil have an uppercase letter right after that sigil? i.e. "@Foobar"? or is it illegal/discouraged (if discouraged, then why?)
[14:20:28] phaul: &ri TracePoint#method_id, ryouba
[14:20:28] rubydoc: ryouba: https://ruby-doc.org/core-2.6/TracePoint.html#method-i-method_id
[14:20:37] phaul: or callee_id
[14:20:43] ryouba: thanks phaul! :)
[14:30:49] tdy: has joined #ruby
[14:46:58] conta: has joined #ruby
[14:51:12] keden: has joined #ruby
[14:53:26] agent_white: has joined #ruby
[14:55:10] ryouba: damn, ruby is awesome
[14:55:30] ryouba: i wish every computer was programmable with it
[14:55:35] keden: Damn right.
[14:56:05] Renich: has joined #ruby
[14:56:05] jane_booty_doe: has joined #ruby
[14:56:35] fox_mulder_cp: renich: no. but some like salt :)
[14:57:47] Inline: has joined #ruby
[14:58:38] Sylario: has joined #ruby
[14:58:53] rippa: has joined #ruby
[15:08:16] ytti: ryouba, compared to main competitor, python, it is absolute joy
[15:08:29] ytti: much more consistent design and completeness of vision
[15:08:54] ytti: however, like python i think ultimately poor fit for non-trivial long-lived projects
[15:14:15] kiero: hi, is there any program that prints yaml file with all aliases, maps substituted?
[15:16:16] keden: ytti: I've seen some pretty large scale services written in Ruby.
[15:17:32] ytti: keden, me too
[15:19:38] Rapture: has joined #ruby
[15:26:19] TheBloke: has joined #ruby
[15:28:05] conta: has joined #ruby
[15:33:15] keden: has joined #ruby
[15:34:07] keden: has joined #ruby
[15:36:12] polishdub: has joined #ruby
[15:37:45] Renich: has joined #ruby
[15:50:35] whathappens: has joined #ruby
[15:54:50] szulak_: has joined #ruby
[15:56:40] spacesuitdiver: has joined #ruby
[16:00:27] Swyper: has joined #ruby
[16:01:06] whathappens: has joined #ruby
[16:09:50] kent\n: has joined #ruby
[16:17:06] agent_white: has joined #ruby
[16:19:33] sagax: how to return hash with standart raise? raise StandardError, {:foo => "bar"}
[16:20:04] sagax: when i catch err.message in rescue i see that err.message it's string
[16:21:12] orbyt_: has joined #ruby
[16:26:40] darix: sagax: this feels wrong
[16:26:58] darix: sagax: set a variable and check that in your exception handler
[16:29:15] mangold: has joined #ruby
[16:41:53] CrazyEddy: has joined #ruby
[16:42:35] dionysus70: has joined #ruby
[16:43:59] spacesuitdiver: has joined #ruby
[16:45:54] nwradio: has joined #ruby
[16:46:57] DTZUZO: has joined #ruby
[16:53:04] Renich: has joined #ruby
[16:54:23] phaul: how about class MyError < StandardError; def initialize(hash, *args) super(args); @hash = hash; end; attr_reader :hash; end ?
[16:54:59] phaul: i forgot to splat args in super. but you get the idea...
[16:58:11] agent_white: has joined #ruby
[17:00:06] agent_white: has joined #ruby
[17:00:58] ytti: that would be at least cleaner solution in any case
[17:01:05] ytti: even if there is some answer to original question
[17:03:06] tdy: has joined #ruby
[17:03:48] gix: has joined #ruby
[17:05:18] phaul: oh you mean set variable and check it in exception handler? for a start that assumes that the context of the raise is accesible at the catch
[17:05:41] luminous: has joined #ruby
[17:05:57] nwradio: has joined #ruby
[17:05:59] ytti: no i mean your solution is cleaner solution than what OP is asking for
[17:06:22] ytti: even if OP's original problem has solution, it's inferior to sublcassing StandardError
[17:06:54] phaul: I see, we agree.
[17:08:24] reber: has joined #ruby
[17:22:31] SeepingN: has joined #ruby
[17:26:50] elphe: has joined #ruby
[17:27:31] whathappens: has joined #ruby
[17:27:50] Dbugger: has joined #ruby
[17:28:36] reber__: has joined #ruby
[17:32:28] orbyt_: has joined #ruby
[17:42:58] cd: has joined #ruby
[17:44:15] [Butch]: has joined #ruby
[17:45:49] dionysus70: has joined #ruby
[17:47:38] conta: has joined #ruby
[17:48:09] orbyt_: has joined #ruby
[17:49:30] whathappens: has joined #ruby
[17:57:26] whathappens: has joined #ruby
[17:57:45] ravenousmoose: has joined #ruby
[18:04:14] skryking: has joined #ruby
[18:09:32] mamantoha: has joined #ruby
[18:12:02] conta: has joined #ruby
[18:16:21] havenwood: ryouba: You *can* use upper case characters in an instance variable, but don't. There is a very strong convention for always using snake_case with instance variables.
[18:17:27] havenwood: ryouba: Conventions like this are partly because that's how Matz likes it aesthetically, but they serve an important role in facilitating ease of reading the code.
[18:20:46] havenwood: ytti: We've interestingly been enjoying Ruby for very large, long-term projects. I think part of the reason is that more time was spent in the Ruby codebases on testing and monitoring tools than in our Go and Java codebases.
[18:21:04] millerti: has joined #ruby
[18:21:34] ytti: havenwood, yes other things matter more than language
[18:22:23] jcarl43: has joined #ruby
[18:23:39] ytti: ruby is my main choice still, i can't get excited about go, it's simple to a fault
[18:23:46] ytti: i understand the use-case, and why goog built it
[18:23:57] ytti: they want to hire hundreds of junior engineers have them actually able to produce something
[18:24:07] ytti: people who are not passionated about programming but it's just a job (which is fine)
[18:24:27] ytti: right now, i think i'm most optimistic about kotlin
[18:24:36] phaul: not fine. but that's the world we live in ;)
[18:24:46] ytti: and seems transition from ruby isn't going to be rough, still very much type.method lambda
[18:26:12] tdy: has joined #ruby
[18:26:57] kapil____: has joined #ruby
[18:28:58] hiroaki_: has joined #ruby
[18:29:57] dellavg__: has joined #ruby
[18:31:20] TheBloke: has joined #ruby
[18:36:23] jaddison: has joined #ruby
[18:40:48] Renich: has joined #ruby
[18:44:15] Renich: has joined #ruby
[18:48:48] [Butch]: has joined #ruby
[18:48:48] cnsvc_: has joined #ruby
[18:54:19] elphe: has joined #ruby
[18:58:53] sameerynho: has joined #ruby
[19:00:11] tdy: has joined #ruby
[19:00:23] nowhereman: has joined #ruby
[19:07:06] robotcars: has joined #ruby
[19:08:41] ascarter: has joined #ruby
[19:09:51] robotcars: can I get a suggestion on how to use unless for negated if on this line? https://github.com/ccsd/ledbelly/blob/master/src/ledbelly_worker.rb#L86
[19:12:06] havenwood: robotcars: unless EVENT_DDL[event_table.to_sym].key?(k)
[19:12:39] havenwood: robotcars: change the `if` to an `unless` and remove the bang ("!")
[19:13:38] robotcars: can I use next unless multiple times in iteratio, L91/101
[19:13:59] havenwood: robotcars: Switch `require` with `./` to `require_relative` with `./` removed: https://github.com/ccsd/ledbelly/blob/master/src/ledbelly_worker.rb#L1
[19:15:34] havenwood: robotcars: On line 22-3, you might consider #dig: ...attributes.dig('event_name', 'string_value')
[19:16:32] havenwood: robotcars: It's nice to `warn` with errors instead of `puts`, so it goes to stderr instead of stdout.
[19:16:46] ravenousmoose: has joined #ruby
[19:16:49] havenwood: robotcars: #abort also takes an argument, which will print to stderr as well
[19:18:28] havenwood: robotcars: I prefer `$stdout.tty?`, just because I think it looks nicer.
[19:19:28] havenwood: robotcars: I'd suggest onelining: next if v.nil?
[19:19:38] havenwood: If the truthiness suffices: next unless v
[19:20:52] havenwood: robotcars: I'd extract this to a constant WARN_ERRORS and freeze it: https://github.com/ccsd/ledbelly/blob/master/src/ledbelly_worker.rb#L133-L141
[19:21:18] robotcars: same with disconnect?
[19:21:30] havenwood: same with `disconnect_errors`
[19:21:31] havenwood: robotcars: yup!
[19:22:01] havenwood: You can drop the `./` here: https://github.com/ccsd/ledbelly/blob/master/src/ledbelly_worker.rb#L168
[19:22:03] robotcars: and $stdout.tty? vs $stdout.isatty
[19:23:24] d^sh: has joined #ruby
[19:23:48] havenwood: robotcars: Actually, I'd probably go ahead and set the constant to: Regexp.union(disconnect_errors).freeze
[19:27:51] orbyt_: has joined #ruby
[19:29:34] robotcars: havenwood: ty for suggestions and help
[19:29:45] robotcars: are my next unless valid, https://gist.github.com/robert-carroll/0c7b1662509d02e612fb2f1ed8f9c539
[19:31:46] robotcars: wierd logic to get used to… i feel like i've added the first one for troubleshooting, but seems like it will skip iteration for the other conditions
[19:32:44] leftylink: it would be fair to think of it as "next unless X" means that after this line, X is certainly true
[19:32:56] leftylink: so hopefully X is what you want it to be
[19:33:25] Swyper: has joined #ruby
[19:35:41] robotcars: so I can use it in step progression, with multiple next's
[19:35:52] robotcars: ty leftylink
[19:37:42] sagax: has joined #ruby
[19:39:17] conta: has joined #ruby
[19:41:30] Swyper: has joined #ruby
[19:41:51] jaddison: has joined #ruby
[19:45:02] postmodern: has joined #ruby
[19:55:10] elphe: has joined #ruby
[20:07:34] reber: has joined #ruby
[20:07:47] reber__: has joined #ruby
[20:09:48] kaleido: has joined #ruby
[20:10:15] orbyt_: has joined #ruby
[20:10:46] phaul: &url https://gist.githubusercontent.com/phaul/cb4db572ebd49137851057bee34120da/raw/db506cf6f3d79e83aecc3449d746e442475a6452/x.rb, leftylink
[20:10:52] rubydoc: leftylink: # => 2 (https://carc.in/#/r/6f9m)
[20:12:23] leftylink: ACTION hand on chin
[20:12:31] phaul: I dont know if this can do what you wanted, but now we have it :)
[20:14:44] leftylink: for the particular case I wanted to do last time (use someone's gist, and then add an example usage of the gist to show that it still needs work), one would need to be able to append extra content to the contents of the gist. I don't know how commonly one wants to do that, but that would be what I wanted
[20:15:02] kaleido: example = ->(s)
[20:15:09] kaleido: what is the -> doing there?
[20:15:21] leftylink: one can search for that using the term "stabby lambda"
[20:15:31] kaleido: example = ->(s){ stuff }
[20:15:53] elphe: has joined #ruby
[20:16:24] leftylink: one can call a lambda using [] or .call or .()
[20:21:58] c-c: ytti: have you looked at rust lately?
[20:22:29] tdy: has joined #ruby
[20:23:07] antigerme_: has joined #ruby
[20:24:59] ellcs: has joined #ruby
[20:33:17] szulak_: has joined #ruby
[20:34:44] t0x: has joined #ruby
[20:35:05] ascarter: has joined #ruby
[20:36:42] elphe: has joined #ruby
[20:38:28] conta: has joined #ruby
[20:48:55] ytti: c-c, i have, i like rust too, but it's too hard for me, like c++ the amount of work needed to be productive is too much for my lazy ass right now
[20:49:06] ytti: but generally kotlin, rust, ruby follow type.method lambda
[20:49:23] ytti: it's interesting that both kotlin and rust have quite strong standard library
[20:49:33] ytti: i need to write some python eveyr now and then, i keep being surprised how poor the standard library is
[20:49:48] ytti: rust is particularly interesting example, as people have rewritten classic unix tools like find, ls etc with rust
[20:49:54] ytti: and they just run circles around C implementations
[20:50:18] ytti: not becuse rust is faster than c, obviously, but because it implements so much in standard library, people don't need to reinvent the wheel for every problem
[20:50:25] Calinou: I thought the Python standard library was comprehensive, to the point of being called "bloated" by many
[20:50:35] Calinou: unlike JavaScript where it's intentionally minimal
[20:50:39] ytti: if you look like lists, dicts
[20:50:48] ytti: and compare methods python offers tothose, and what ruby, rust, kotlin offer
[20:50:53] ytti: then python is quite poor
[20:51:09] ytti: like just removing items matching to a lambda and returning remaining items, can't do it
[20:51:28] ytti: in all rust, ruby and kotlin matching, non_mathing = list.partition lambda
[20:52:41] BTRE: has joined #ruby
[20:53:55] [Butch]: has joined #ruby
[20:54:31] marmotini_: has joined #ruby
[21:00:11] elphe: has joined #ruby
[21:00:26] ravenousmoose: has joined #ruby
[21:09:43] xrexeon: has joined #ruby
[21:12:08] hightower3: has joined #ruby
[21:19:44] reber__: has joined #ruby
[21:20:54] elphe: has joined #ruby
[21:24:12] hiroaki_: has joined #ruby
[21:27:56] Net: I'm getting `find_spec_for_exe': can't find gem irb (>= 0.a) with executable irb when running irb with rbenv
[21:30:14] Net: that's when using the system ruby
[21:30:47] Net: gem install irb fixed it, but seems weird
[21:34:15] kirun: has joined #ruby
[21:35:57] eightfold: has joined #ruby
[21:37:27] eightfold: i’ve used --user-install with gem. when trying to use the installed gems they can’t be found. how can i set path so that user dir gems are always prioritized
[21:40:24] c-c: eightfold: do you have ~/.gem?
[21:41:16] c-c: is ruby in your PATH?
[21:41:41] elphe: has joined #ruby
[21:42:03] eightfold: well, even /Users/eightfold/.gem/ruby/2.3.0/bin is in my path
[21:42:06] eightfold: i see that now
[21:42:29] c-c: hm and whats echo say for $GEM_HOME and $GEM_PATH
[21:43:48] eightfold: echo $GEM_HOME
[21:43:50] eightfold: gives me nada
[21:44:08] eightfold: echo $GEM_PATH
[21:44:11] eightfold: gives me nada too
[21:44:18] c-c: btw whats your shell and OS?
[21:46:06] eightfold: well actually, it’s not really nada. they give me an empty line
[21:47:03] jaddison: has joined #ruby
[21:47:17] c-c: eightfold: maybe you need gem environment
[21:47:29] ruby[bot]: c-c: Missing command under rbenv? Did you try `rbenv rehash`?
[21:47:37] c-c: $ gem environment
[21:48:01] havenwood: c-c: rbenv maintains a dir of shims and puts that dir in your PATH
[21:48:29] c-c: hm, wherecha pick up on the rbenv clue? Wasn't that Net
[21:49:01] c-c: eightfold: so you have rbenv? 8)
[21:49:09] Net: I did try rehashing, if that was meant for me
[21:49:10] havenwood: c-c: Switch to chruby for a quick fix. Or check your shim dir and figure out why it's either not in your PATH or the shims aren't being created
[21:49:26] eightfold: c-c: perhaps i should. because this is hell
[21:49:31] havenwood: Net: yes, that was meant for you
[21:49:35] eightfold: trying to keep a working install of jekyll
[21:49:40] Net: didn't fix it
[21:49:44] c-c: eightfold: just run what I said at :47
[21:49:45] eightfold: works for a a while, then errors
[21:49:49] havenwood: Net: err, i'm not even close here - drinking more coffee
[21:49:51] Net: seems like my system irb just got uninstalled somehow
[21:50:20] eightfold: c-c: https://pastebin.com/jygmtNN4
[21:50:21] ruby[bot]: eightfold: we in #ruby do not like pastebin.com, it loads slowly for most, has ads which are distracting and has terrible formatting. Please use https://gist.github.com
[21:51:01] c-c: eightfold: looks to me like your homedir gem is in the gem path
[21:51:28] c-c: eightfold: you think those are correct paths?
[21:52:29] havenwood: Net: How odd.
[21:53:07] eightfold: c-c: which path?
[21:53:59] c-c: eightfold: all the paths for gems and bins in your user dir
[21:54:41] havenwood: eightfold: it's expected that your installation directory will be in your gem paths.
[21:55:30] havenwood: eightfold: which in this case is true, but it's: /Library/Ruby/Gems/2.3.0
[21:55:30] eightfold: yeah, they seem to be correct
[21:55:36] havenwood: this looks like system Ruby
[21:55:44] havenwood: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
[21:56:30] c-c: eightfold: so maybe you can follow this, to make your own ~/.gemrc to run with that flag
[21:56:45] c-c: eightfold: also, $ gem which
[21:56:46] eightfold: so —user-install seems to install to 2.3.0 dir
[21:57:45] havenwood: eightfold: so you're trying to use system Ruby to install gems locally?
[21:58:11] c-c: trying to install gems in ~/.gem
[21:58:37] eightfold: havenwood: i’m just trying to maintaining a working jekyll installation. not doing very well. not sure what is the right method.
[21:58:53] eightfold: —user-install seemed like a good idea
[22:00:00] elphe: has joined #ruby
[22:00:04] c-c: eightfold: you can set --install-dir
[22:00:34] eightfold: and i guess i don’t want to use system ruby
[22:00:36] eightfold: as it’s old
[22:00:36] c-c: (I guess also should then --bindir)
[22:01:03] eightfold: i just want to do what works, K.I.S.S.
[22:01:16] eightfold: why —install-dir over —user-install?
[22:01:22] c-c: I wonder why --user-isntall didn't work
[22:01:32] eightfold: ~/.gem seems like an ok dir
[22:03:20] c-c: eightfold: seems to me your best bet is to go through https://guides.rubygems.org/faqs/
[22:03:33] eightfold: i have ~/.gem/ruby/2.3.0/bin/
[22:03:39] eightfold: seems installation went there
[22:03:43] eightfold: with --user-install
[22:03:59] eightfold: i think i’ll end up using the docker installation of jekyll
[22:04:12] eightfold: seems i can’t maintain working installation
[22:05:09] c-c: Well, one must maintain couple of env variables in a shell session. If thats too complex, maybe stick to system gems.
[22:05:41] c-c: and yeah, sometimes it takes couple of hours just to get things in line with the env var conf
[22:20:38] elphe: has joined #ruby
[22:20:44] oosehedaiphequag: has joined #ruby
[22:20:50] havenwood: eightfold: most folk recommend not using system Ruby with macOS, for various reasons: https://ryanbigg.com/2015/06/mac-os-x-ruby-ruby-install-chruby-and-you
[22:29:04] kaleido: "weather"=>[{"id"=>800, "main"=>"Clear"}], but getting ["weather"]["main"] throws an error. what am i doing wrong to the hash after JSON.parse?
[22:30:37] aaaa: has left #ruby: ()
[22:30:54] havenwood: kaleido: what's the error?
[22:31:05] kaleido: TypeError: no implicit conversion of String into Integer
[22:31:56] kaleido: [18] pry(main)> skies = parsed["weather"]["main"]
[22:31:56] kaleido: TypeError: no implicit conversion of String into Integer
[22:34:58] havenwood: kaleido: that usually means you have an Array when you think you have a Hash
[22:36:00] kaleido: so am i getting bogus json to put through JSON.parse i wonder
[22:36:32] havenwood: kaleido: What is?: parsed.class
[22:36:40] havenwood: kaleido: Array?
[22:36:52] kaleido: [20] pry(main)> parsed.class
[22:37:05] havenwood: kaleido: then it's: parsed["weather"].class
[22:37:27] kaleido: wel shit it's an array
[22:37:32] havenwood: kaleido: parsed["weather"].map { |weather| weather["main"] }
[22:38:26] kaleido: damned. thank you, sir!
[22:40:36] tdy: has joined #ruby
[22:41:19] kirun: I'm seeing something unexpected with respond_to_missing? : https://dpaste.de/9sgq
[22:41:26] elphe: has joined #ruby
[22:47:22] elcuervo: has joined #ruby
[22:51:40] mamantoha: has joined #ruby
[23:04:47] Nicmavr: has joined #ruby
[23:06:50] ascarter: has joined #ruby
[23:11:09] johnny56_: has joined #ruby
[23:11:26] havenwood: kirun: That seems like a CRuby-specific quirk that's reproducible with #method and #public_method.
[23:12:09] havenwood: kirun: Interestingly, CRuby, JRuby and TruffleRuby each have slightly different behavior here: https://gist.github.com/havenwood/679c6ad1dc018f0750389bd4c21abdc9
[23:12:53] havenwood: kirun: Note, with `foo.respond_to?('bar')` it'd be `:bar` across the board.
[23:28:18] kirun: havenwood: Thanks for that. If every ruby does something different it means I'm not the crazy one for once.
[23:29:17] laaron-: has joined #ruby
[23:34:03] duderonomy: has joined #ruby
[23:35:35] ellcs: has joined #ruby
[23:42:07] elphe: has joined #ruby
[23:49:09] zenspider: kirun: it's just the first call that comes out as a string, it's not the value itself.
[23:49:21] zenspider: that's a legit bug imo and should be filed on bugs.ruby-lang.org
[23:50:57] sgen: has joined #ruby
[23:53:55] zenspider: that's an odd one. the existance of the symbol, regardless of location or whether it gets eval'd, determines what respond_to_missing? winds up being passed...
[23:55:04] eightfold: has joined #ruby
[23:56:04] mamantoha: has joined #ruby
[23:59:16] zenspider: I was partially wrong... if you switch from "posts" to "a", it doesn't reproduce...