havenwood changed the topic of #ruby to: Rules & more: https://ruby-community.com | Ruby 2.6.1, 2.5.3, 2.4.5: 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!
mahlon has quit [Read error: Connection reset by peer]
tbuehlmann has quit [Ping timeout: 252 seconds]
mahlon has joined #ruby
rprimus has quit [Ping timeout: 245 seconds]
rprimus has joined #ruby
tbuehlmann has joined #ruby
conta has joined #ruby
conta has quit [Ping timeout: 240 seconds]
mangold has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
sameerynho has quit [Ping timeout: 240 seconds]
helpa has quit [Remote host closed the connection]
orbyt_ has joined #ruby
nahra has quit [Remote host closed the connection]
helpa has joined #ruby
lukelukeluke has quit [Ping timeout: 240 seconds]
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #ruby
stryek has quit [Quit: Connection closed for inactivity]
mangold has quit [Quit: This computer has gone to sleep]
AJA4350 has quit [Remote host closed the connection]
orbyt_ has quit [Ping timeout: 252 seconds]
bjpenn has joined #ruby
<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
<bjpenn> is this what modules are for in ruby?
elphe has quit [Ping timeout: 245 seconds]
<bjpenn> basically i have a variable that i want accessed by multiple methods
<bjpenn> without classes i can only use consts for that variable right?
elphe has joined #ruby
orbyt_ has joined #ruby
[Butch] has quit [Quit: Textual IRC Client: www.textualapp.com]
<Eiam> you could just put them in a struct
<bjpenn> ah ok... let me look up how that works
<bjpenn> im new to ruby
<Eiam> modules are for namespacing and mixins
elphe has quit [Ping timeout: 245 seconds]
<bjpenn> so if i create a struct, it would be in the global namespace?
bmurt has joined #ruby
<bjpenn> looking at this link here...
<bjpenn> basically i would declare a "Credentials" struct, for example... which would have a 'username' and a 'password' field
<Eiam> its namespaced where you create it
<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
<bjpenn> my script doesnt include modules so it would just be global scope i guess
<Eiam> if this is just a single .rb trying to poke at some problem that doesn't seem 'bad'
<Eiam> I do it all the time but I could be the worst programmer in the world =)
<bjpenn> yeah this is just a single .rb
<bjpenn> i guess ill try and get it to work with struct and see how it goes
mangold has joined #ruby
<bjpenn> my whole script is executed within a method called "execute"
<bjpenn> i cant really create teh struct in there because then it would only be scoped to that definition
<bjpenn> and i dont want to pass that struct everywhere
<bjpenn> what other options do i have?
SanguineAnomaly has quit [Ping timeout: 246 seconds]
SanguineAnomaly has joined #ruby
elphe has joined #ruby
<Eiam> declare it at the top? =)
SanguineAnomaly has quit [Ping timeout: 240 seconds]
SanguineAnomaly has joined #ruby
Tempesta has quit [Ping timeout: 268 seconds]
<bjpenn> is this bad style
<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
<bjpenn> def api_creds $global_var ||= expensive_rest_call_to_get_creds()
<bjpenn> def api_creds() $global_var ||= expensive_rest_call_to_get_creds(); end
<bjpenn> maybe thats the more correct way to do a oneliner
<Eiam> why are you forcing this to one line? is there some kind of quota on newlines?
<bjpenn> oh im just trying to show what im doing without pasting multiple lines
<bjpenn> the focus is not that its using one line, its that its using a global var
<bjpenn> to store something
<Eiam> ah, you can use https://dpaste.de for easy formatting too
<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?
<bjpenn> every subsequent time i call api_creds() it will just return $global_var right?
APK has joined #ruby
AKPWD has quit [Ping timeout: 245 seconds]
<Eiam> depends on what expensive_rest_call_to_get_creds() returns
<bjpenn> thats supposed to return the credentials
<bjpenn> lets say like {'username': foo', 'password':'bar'}
<Eiam> if it returns false, it could change on subsequent calls
<Eiam> otherwise yes it should do what you want
<bjpenn> if expensive_rest_call_to_get_creds() returns false
<bjpenn> ?
<Eiam> yes
<bjpenn> then $global_var would never get set right?
<bjpenn> or it would get set to false?
<Eiam> a ||= b is "a || b"
<Eiam> yes, it would be set to false
<Eiam> >> a ||= false
<ruby[bot]> Eiam: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
<Eiam> uh works in irb
* Eiam pokes ruby[bot]
<Eiam> a = a || b rather, omitted the first part =)
<Eiam> bjpenn: it would go from 'nil' to 'false' which isn't quite the same thing. probably doesn't matter
<Eiam> until its 2am and your code isn't working
<bjpenn> haha
<bjpenn> thats what im afraid of :)
<bjpenn> i get i can make sure expensive_rest_call() returns nil in the failure condition right?
<bjpenn> if it does return nil though, then api_creds() would return false?
<bjpenn> or just return nil?
iNs has quit [Ping timeout: 256 seconds]
<bjpenn> i think probably just nil right?
iNs has joined #ruby
<bjpenn> testing :)
<bjpenn> yup nil!
SeepingN has quit [Quit: The system is going down for reboot NOW!]
evdubs has quit [Quit: Leaving]
mangold has quit [Quit: This computer has gone to sleep]
evdubs has joined #ruby
Onwarion has joined #ruby
Leifr has quit [Quit: Going offline, see ya! (www.adiirc.com)]
Onwarion_re has quit [Ping timeout: 245 seconds]
gix has quit [Ping timeout: 255 seconds]
agent_white has quit [Quit: leaving]
agent_white has joined #ruby
tdy has quit [Ping timeout: 240 seconds]
iNs has quit [Remote host closed the connection]
iNs has joined #ruby
Tempesta has joined #ruby
t0x has quit [Quit: Connection closed for inactivity]
ua has quit [Ping timeout: 246 seconds]
ua has joined #ruby
laaron has quit [Remote host closed the connection]
laaron has joined #ruby
bjpenn has quit [Ping timeout: 240 seconds]
sonander has joined #ruby
tdy has joined #ruby
braincrash has quit [Quit: bye bye]
braincrash has joined #ruby
agent_white has quit [Quit: bbl]
v01d4lph4 has joined #ruby
spacesuitdiver has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Inline has quit [Quit: Leaving]
elphe has quit [Ping timeout: 252 seconds]
Xiti has quit [Ping timeout: 245 seconds]
kapil____ has joined #ruby
Xiti has joined #ruby
gregf_ has quit [Ping timeout: 256 seconds]
dviola has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ur5us has joined #ruby
ur5us has quit [Ping timeout: 255 seconds]
bga57 has quit [Ping timeout: 240 seconds]
elphe has joined #ruby
mangold has joined #ruby
mangold has quit [Quit: This computer has gone to sleep]
govg has quit [Ping timeout: 245 seconds]
bga57 has joined #ruby
mangold has joined #ruby
conta has joined #ruby
fluxAeon has joined #ruby
mangold has quit [Quit: This computer has gone to sleep]
Rudd0 has joined #ruby
mangold has joined #ruby
Pisuke has joined #ruby
aupadhye has joined #ruby
MyMind has quit [Ping timeout: 245 seconds]
elphe has quit [Ping timeout: 255 seconds]
iMadper has joined #ruby
za1b1tsu has joined #ruby
sgen has joined #ruby
spacesuitdiver has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
reber has joined #ruby
elphe has joined #ruby
pskosinski has joined #ruby
mangold has quit [Quit: This computer has gone to sleep]
lightstalker has quit [Ping timeout: 240 seconds]
lightstalker has joined #ruby
mangold has joined #ruby
renich has quit [Remote host closed the connection]
Leifr has joined #ruby
clemens3_ has joined #ruby
elphe has quit [Ping timeout: 245 seconds]
aufi has joined #ruby
fluxAeon has quit [Ping timeout: 240 seconds]
pskosinski has quit [Remote host closed the connection]
manakanapa1 has quit [Ping timeout: 268 seconds]
elphe has joined #ruby
t0x has joined #ruby
tdy has quit [Ping timeout: 246 seconds]
elphe has quit [Ping timeout: 245 seconds]
reber has quit [Remote host closed the connection]
elphe has joined #ruby
Sembei has joined #ruby
Pisuke has quit [Ping timeout: 240 seconds]
postmodern has quit [Quit: Leaving]
lxsameer has joined #ruby
cnsvc_ has quit [Ping timeout: 256 seconds]
sgen has quit [Remote host closed the connection]
sgen has joined #ruby
tdy has joined #ruby
tdy has quit [Ping timeout: 245 seconds]
sgen has quit [Read error: Connection reset by peer]
sgen has joined #ruby
DTZUZO has quit [Ping timeout: 245 seconds]
vonfry has joined #ruby
<vonfry> quit
vonfry has quit [Client Quit]
mangold has quit [Quit: This computer has gone to sleep]
apparition has joined #ruby
ryouba has joined #ruby
DTZUZO has joined #ruby
ellcs has joined #ruby
tdy has joined #ruby
conta has quit [Ping timeout: 250 seconds]
dionysus70 has joined #ruby
_whitelogger has joined #ruby
<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")?
<Radar> yes
<ryouba> how, Radar? :)
<Radar> first question is free
<ryouba> :(
<Radar> second question, also free
* ryouba gets a parcel and puts a mug with coffee in it for Radar
<Radar> I would do it like this: "comment_xls".gsub(/(.*)_(.*)/) { "#{$2.upcase} #{$1}" }
<Radar> The block is evaluated once the gsub does its thing
<ryouba> oh, it also takes a block!
<ryouba> and what's the difference between \n and $n?
tdy has quit [Ping timeout: 240 seconds]
<Radar> I am not entirely sure.
<ryouba> perhaps there is none
rubydoc has quit [Remote host closed the connection]
rubydoc has joined #ruby
helpa has quit [Read error: Connection reset by peer]
tdy has joined #ruby
<ryouba> hmm ... \n doesn't work with #{}
<ryouba> good to know
helpa has joined #ruby
<Radar> $1, $2 and so on are special global variables available after a regex match
<ryouba> curious, somewhere i must have picked up the \n notation, apparently not in the context of ruby
<phaul> backreferences are also in ruby
<phaul> &>> "comment_xls".gsub(/(.*)_(.*)/, '\2 \1')
<rubydoc> # => "xls comment" (https://carc.in/#/r/6f5g)
<phaul> problem is how you put the upcase on it
<ryouba> oh that's even a little shorter
<ryouba> but yes
<phaul> '\2'.upcase is just '\2' :)
* ryouba tries to stuff a fresh EEPROM into his brain to retain all that info
<Radar> &>> "comment_xls".gsub(/(.*)_(.*)/, '\2 \1').gsub("xls", "XLS")
<rubydoc> # => "XLS comment" (https://carc.in/#/r/6f5h)
<Radar> next question plz
conta has joined #ruby
<ryouba> Radar: sorry, for now i'm out of questions :-P
<Radar> ryouba: that's okay. I am out of energy. I will sleep now. See you tomorrow.
tdy has quit [Read error: error:1408F119:SSL routines:ssl3_get_record:decryption failed or bad record mac]
<ryouba> sleep well!
elphe has quit [Ping timeout: 255 seconds]
paraxial has joined #ruby
Leifr has quit [Quit: Going offline, see ya! (www.adiirc.com)]
elphe has joined #ruby
DTZUZO has quit [Ping timeout: 240 seconds]
jdawgaz has joined #ruby
Fernando-Basso has joined #ruby
jdawgaz has quit [Ping timeout: 255 seconds]
AJA4350 has joined #ruby
lucasb has joined #ruby
Tharbakim has quit [Ping timeout: 258 seconds]
tdy has joined #ruby
tdy has quit [Read error: error:1408F119:SSL routines:ssl3_get_record:decryption failed or bad record mac]
Tharbakim has joined #ruby
tdy has joined #ruby
Tharbakim has quit [Ping timeout: 245 seconds]
Nicmavr has quit [Read error: Connection reset by peer]
Nicmavr has joined #ruby
tdy has quit [Read error: error:1408F119:SSL routines:ssl3_get_record:decryption failed or bad record mac]
Tharbakim has joined #ruby
pskosinski has joined #ruby
jane_booty_doe has quit [Quit: The Lounge - https://thelounge.chat]
jane_booty_doe has joined #ruby
za1b1tsu has quit [Ping timeout: 240 seconds]
dionysus70 has quit [Ping timeout: 245 seconds]
bmurt has joined #ruby
elphe has quit [Ping timeout: 255 seconds]
michael_mbp has quit [Ping timeout: 246 seconds]
stryek has joined #ruby
elphe has joined #ruby
apparition has quit [Quit: Bye]
michael_mbp has joined #ruby
pskosinski has quit [Ping timeout: 245 seconds]
jane_booty_doe has quit [Quit: The Lounge - https://thelounge.chat]
za1b1tsu has joined #ruby
Tuor has joined #ruby
v01d4lph4 has quit [Read error: Connection reset by peer]
<ryouba> hey that would be an interesting idea
<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"?
dviola has quit [Quit: WeeChat 2.4]
<phaul> &ri TracePoint
<phaul> ryouba: ^
<ryouba> :-D
* ryouba tries
saysjonathan has joined #ruby
mangold has joined #ruby
<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?
<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?)
<phaul> &ri TracePoint#method_id, ryouba
<phaul> or callee_id
<ryouba> thanks phaul! :)
tdy has joined #ruby
t0x has quit [Quit: Connection closed for inactivity]
Tuor has quit [Quit: Konversation terminated!]
conta has quit [Quit: conta]
conta has joined #ruby
keden has joined #ruby
agent_white has joined #ruby
<ryouba> damn, ruby is awesome
<ryouba> i wish every computer was programmable with it
<ryouba> <3
<keden> Damn right.
renich has joined #ruby
jane_booty_doe has joined #ruby
<fox_mulder_cp> renich: no. but some like salt :)
Inline has joined #ruby
sylario has joined #ruby
rippa has joined #ruby
jane_booty_doe has quit [Client Quit]
aupadhye has quit [Ping timeout: 255 seconds]
<ytti> ryouba, compared to main competitor, python, it is absolute joy
<ytti> much more consistent design and completeness of vision
<ytti> however, like python i think ultimately poor fit for non-trivial long-lived projects
conta has quit [Ping timeout: 252 seconds]
<kiero> hi, is there any program that prints yaml file with all aliases, maps substituted?
<kiero> cli one
<keden> ytti: I've seen some pretty large scale services written in Ruby.
<ytti> keden, me too
Rapture has joined #ruby
mangold has quit [Quit: This computer has gone to sleep]
renich has quit [Ping timeout: 245 seconds]
TheBloke has quit [Ping timeout: 255 seconds]
sonander has quit [Quit: Quit]
TheBloke has joined #ruby
conta has joined #ruby
conta has quit [Ping timeout: 255 seconds]
keden has quit [Quit: WeeChat 2.4]
keden has joined #ruby
keden has quit [Client Quit]
keden has joined #ruby
lxsameer has quit [Quit: out]
polishdub has joined #ruby
renich has joined #ruby
renich has quit [Quit: renich]
whathappens has joined #ruby
szulak_ has joined #ruby
whathappens has quit [Ping timeout: 252 seconds]
spacesuitdiver has joined #ruby
Swyper has joined #ruby
whathappens has joined #ruby
kent\n has quit [Remote host closed the connection]
kent\n has joined #ruby
agent_white has quit [Quit: brb]
agent_white has joined #ruby
<sagax> hi all!
<sagax> how to return hash with standart raise? raise StandardError, {:foo => "bar"}
<sagax> when i catch err.message in rescue i see that err.message it's string
CrazyEddy has quit [Remote host closed the connection]
orbyt_ has joined #ruby
aufi has quit [Ping timeout: 250 seconds]
keden has quit [Ping timeout: 245 seconds]
<darix> sagax: this feels wrong
<darix> sagax: set a variable and check that in your exception handler
mangold has joined #ruby
Swyper has quit [Remote host closed the connection]
AJA4350 has quit [Remote host closed the connection]
CrazyEddy has joined #ruby
dionysus70 has joined #ruby
spacesuitdiver has quit [Read error: Connection reset by peer]
spacesuitdiver has joined #ruby
szulak_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
nwradio has quit [Quit: Ping timeout (120 seconds)]
dionysus70 has quit [Remote host closed the connection]
nwradio has joined #ruby
DTZUZO has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
renich has joined #ruby
tdy has quit [Ping timeout: 268 seconds]
<phaul> how about class MyError < StandardError; def initialize(hash, *args) super(args); @hash = hash; end; attr_reader :hash; end ?
<phaul> i forgot to splat args in super. but you get the idea...
agent_white has quit [Quit: brb]
agent_white has joined #ruby
agent_white has quit [Client Quit]
agent_white has joined #ruby
<ytti> that would be at least cleaner solution in any case
<ytti> even if there is some answer to original question
tdy has joined #ruby
gix has joined #ruby
whathappens has quit [Ping timeout: 252 seconds]
<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
nwradio has quit [Quit: Ping timeout (120 seconds)]
luminous has joined #ruby
nwradio has joined #ruby
<ytti> no i mean your solution is cleaner solution than what OP is asking for
<ytti> even if OP's original problem has solution, it's inferior to sublcassing StandardError
<phaul> I see, we agree.
APK is now known as AKPWD
reber has joined #ruby
kapil____ has quit [Quit: Connection closed for inactivity]
SeepingN has joined #ruby
elphe has quit [Ping timeout: 245 seconds]
elphe has joined #ruby
whathappens has joined #ruby
Dbugger has joined #ruby
reber__ has joined #ruby
jaddison has quit [Quit: jaddison]
orbyt_ has joined #ruby
luminous has quit [Quit: Goodbye ~ Powered by LunarBNC]
orbyt_ has quit [Ping timeout: 246 seconds]
ellcs has quit [Ping timeout: 255 seconds]
cd has joined #ruby
[Butch] has joined #ruby
dionysus70 has joined #ruby
conta has joined #ruby
orbyt_ has joined #ruby
whathappens has quit [Remote host closed the connection]
whathappens has joined #ruby
conta has quit [Ping timeout: 245 seconds]
clemens3_ has quit [Ping timeout: 246 seconds]
whathappens has quit [Remote host closed the connection]
whathappens has joined #ruby
ravenousmoose has joined #ruby
mangold has quit [Quit: This computer has gone to sleep]
elphe has quit [Ping timeout: 255 seconds]
tdy has quit [Ping timeout: 250 seconds]
skryking has joined #ruby
renich has quit [Remote host closed the connection]
mamantoha has joined #ruby
conta has joined #ruby
mamantoha has quit [Ping timeout: 240 seconds]
<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.
<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.
ravenousmoose has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<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.
millerti has joined #ruby
<ytti> havenwood, yes other things matter more than language
<havenwood> ytti: +1
jcarl43 has joined #ruby
<ytti> ruby is my main choice still, i can't get excited about go, it's simple to a fault
<ytti> i understand the use-case, and why goog built it
<ytti> they want to hire hundreds of junior engineers have them actually able to produce something
<ytti> people who are not passionated about programming but it's just a job (which is fine)
<ytti> right now, i think i'm most optimistic about kotlin
<phaul> not fine. but that's the world we live in ;)
<ytti> and seems transition from ruby isn't going to be rough, still very much type.method lambda
tdy has joined #ruby
sagax has quit [Remote host closed the connection]
kapil____ has joined #ruby
hiroaki_ has joined #ruby
dellavg__ has joined #ruby
TheBloke has quit [Ping timeout: 255 seconds]
TheBloke has joined #ruby
jaddison has joined #ruby
jaddison has quit [Client Quit]
conta has quit [Quit: conta]
renich has joined #ruby
[Butch] has quit [Ping timeout: 245 seconds]
renich has quit [Excess Flood]
renich has joined #ruby
[Butch] has joined #ruby
cnsvc_ has joined #ruby
elphe has joined #ruby
tdy has quit [Ping timeout: 245 seconds]
sameerynho has joined #ruby
elphe has quit [Ping timeout: 255 seconds]
nwradio has quit [Quit: Ping timeout (120 seconds)]
tdy has joined #ruby
nowhereman has joined #ruby
Rapture has quit [Ping timeout: 250 seconds]
robotcars has joined #ruby
ascarter has joined #ruby
<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
<havenwood> robotcars: unless EVENT_DDL[event_table.to_sym].key?(k)
<havenwood> robotcars: change the `if` to an `unless` and remove the bang ("!")
<robotcars> ty
<robotcars> can I use next unless multiple times in iteratio, L91/101
<havenwood> robotcars: Switch `require` with `./` to `require_relative` with `./` removed: https://github.com/ccsd/ledbelly/blob/master/src/ledbelly_worker.rb#L1
<havenwood> robotcars: On line 22-3, you might consider #dig: ...attributes.dig('event_name', 'string_value')
<havenwood> robotcars: It's nice to `warn` with errors instead of `puts`, so it goes to stderr instead of stdout.
ravenousmoose has joined #ruby
<havenwood> robotcars: #abort also takes an argument, which will print to stderr as well
<havenwood> robotcars: I prefer `$stdout.tty?`, just because I think it looks nicer.
<havenwood> robotcars: I'd suggest onelining: next if v.nil?
<havenwood> If the truthiness suffices: next unless v
<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
<robotcars> same with disconnect?
<havenwood> same with `disconnect_errors`
<havenwood> robotcars: yup!
<robotcars> and $stdout.tty? vs $stdout.isatty
d^sh has quit [Ping timeout: 255 seconds]
d^sh has joined #ruby
<havenwood> robotcars: Actually, I'd probably go ahead and set the constant to: Regexp.union(disconnect_errors).freeze
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
orbyt_ has joined #ruby
<robotcars> havenwood: ty for suggestions and help
<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
<leftylink> it would be fair to think of it as "next unless X" means that after this line, X is certainly true
<leftylink> so hopefully X is what you want it to be
Swyper has joined #ruby
Swyper has quit [Remote host closed the connection]
<robotcars> so I can use it in step progression, with multiple next's
<robotcars> ty leftylink
sagax has joined #ruby
conta has joined #ruby
Swyper has joined #ruby
jaddison has joined #ruby
conta has quit [Ping timeout: 240 seconds]
hightower2 has quit [Ping timeout: 245 seconds]
postmodern has joined #ruby
elphe has joined #ruby
jaddison has quit [Quit: jaddison]
elphe has quit [Ping timeout: 255 seconds]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
reber has quit [Remote host closed the connection]
reber__ has quit [Remote host closed the connection]
reber has joined #ruby
reber__ has joined #ruby
kaleido has joined #ruby
orbyt_ has joined #ruby
<rubydoc> leftylink: # => 2 (https://carc.in/#/r/6f9m)
* leftylink hand on chin
<phaul> I dont know if this can do what you wanted, but now we have it :)
<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
<kaleido> example = ->(s)
<kaleido> what is the -> doing there?
<leftylink> one can search for that using the term "stabby lambda"
orbyt_ has quit [Ping timeout: 255 seconds]
<kaleido> example = ->(s){ stuff }
elphe has joined #ruby
<leftylink> one can call a lambda using [] or .call or .()
<kaleido> thanks!
tdy has quit [Ping timeout: 245 seconds]
elphe has quit [Ping timeout: 240 seconds]
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
<c-c> ytti: have you looked at rust lately?
tdy has joined #ruby
antigerme_ has joined #ruby
ellcs has joined #ruby
dellavg__ has quit [Ping timeout: 245 seconds]
za1b1tsu has quit [Ping timeout: 240 seconds]
whathappens has quit []
antigerme_ has quit [Quit: Leaving]
ascarter has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
szulak_ has joined #ruby
Swyper has quit [Remote host closed the connection]
szulak_ has quit [Client Quit]
t0x has joined #ruby
ascarter has joined #ruby
elphe has joined #ruby
Fernando-Basso has quit [Remote host closed the connection]
conta has joined #ruby
elphe has quit [Ping timeout: 255 seconds]
tdy has quit [Ping timeout: 252 seconds]
kapil____ has quit [Quit: Connection closed for inactivity]
conta has quit [Quit: conta]
ravenousmoose has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
BTRE has quit [Remote host closed the connection]
<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
<ytti> but generally kotlin, rust, ruby follow type.method lambda
<ytti> it's interesting that both kotlin and rust have quite strong standard library
ascarter has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<ytti> i need to write some python eveyr now and then, i keep being surprised how poor the standard library is
<ytti> rust is particularly interesting example, as people have rewritten classic unix tools like find, ls etc with rust
<ytti> and they just run circles around C implementations
<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
<Calinou> I thought the Python standard library was comprehensive, to the point of being called "bloated" by many
<Calinou> unlike JavaScript where it's intentionally minimal
<ytti> if you look like lists, dicts
<ytti> and compare methods python offers tothose, and what ruby, rust, kotlin offer
<ytti> then python is quite poor
<ytti> like just removing items matching to a lambda and returning remaining items, can't do it
<ytti> in all rust, ruby and kotlin matching, non_mathing = list.partition lambda
[Butch] has quit [Ping timeout: 255 seconds]
BTRE has joined #ruby
[Butch] has joined #ruby
marmotini_ has joined #ruby
elphe has joined #ruby
ravenousmoose has joined #ruby
elphe has quit [Ping timeout: 255 seconds]
[Butch] has quit [Quit: Textual IRC Client: www.textualapp.com]
xrexeon has joined #ruby
hiroaki_ has quit [Ping timeout: 250 seconds]
hightower3 has joined #ruby
reber__ has quit [Remote host closed the connection]
reber__ has joined #ruby
elphe has joined #ruby
hiroaki_ has joined #ruby
elphe has quit [Ping timeout: 240 seconds]
<Net> I'm getting `find_spec_for_exe': can't find gem irb (>= 0.a) with executable irb when running irb with rbenv
Dbugger has quit [Ping timeout: 240 seconds]
lucasb has quit [Quit: Connection closed for inactivity]
<Net> that's when using the system ruby
<Net> gem install irb fixed it, but seems weird
kirun has joined #ruby
eightfold has joined #ruby
<eightfold> hi
<Net> hi
<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
<eightfold> ?
<c-c> eightfold: do you have ~/.gem?
<eightfold> yup!
<c-c> is ruby in your PATH?
elphe has joined #ruby
<eightfold> well, even /Users/eightfold/.gem/ruby/2.3.0/bin is in my path
<eightfold> i see that now
<c-c> hm and whats echo say for $GEM_HOME and $GEM_PATH
<eightfold> echo $GEM_HOME
<eightfold> gives me nada
<eightfold> echo $GEM_PATH
<eightfold> gives me nada too
<c-c> btw whats your shell and OS?
<eightfold> macos
<eightfold> bash
<eightfold> well actually, it’s not really nada. they give me an empty line
elphe has quit [Ping timeout: 250 seconds]
jaddison has joined #ruby
<c-c> eightfold: maybe you need gem environment
<c-c> I mean
<havenwood> ?rbenv c-c
<ruby[bot]> c-c: Missing command under rbenv? Did you try `rbenv rehash`?
<c-c> $ gem environment
<havenwood> c-c: rbenv maintains a dir of shims and puts that dir in your PATH
<c-c> hm, wherecha pick up on the rbenv clue? Wasn't that Net
<c-c>
<c-c> eightfold: so you have rbenv? 8)
<eightfold> nope
<Net> I did try rehashing, if that was meant for me
<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
reber has quit [Read error: Connection reset by peer]
reber__ has quit [Remote host closed the connection]
<havenwood> oh
<eightfold> c-c: perhaps i should. because this is hell
<havenwood> c-c: sorry
<havenwood> Net: yes, that was meant for you
<eightfold> trying to keep a working install of jekyll
<Net> didn't fix it
<c-c> eightfold: just run what I said at :47
<eightfold> works for a a while, then errors
<havenwood> Net: err, i'm not even close here - drinking more coffee
<Net> seems like my system irb just got uninstalled somehow
<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
<c-c> eightfold: looks to me like your homedir gem is in the gem path
<c-c> eightfold: you think those are correct paths?
<havenwood> Net: How odd.
<eightfold> c-c: which path?
<Net> indeed
<c-c> eightfold: all the paths for gems and bins in your user dir
<havenwood> eightfold: it's expected that your installation directory will be in your gem paths.
<havenwood> eightfold: which in this case is true, but it's: /Library/Ruby/Gems/2.3.0
<eightfold> yeah, they seem to be correct
<havenwood> this looks like system Ruby
<havenwood> /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
<c-c> eightfold: so maybe you can follow this, to make your own ~/.gemrc to run with that flag
<c-c> eightfold: also, $ gem which
<eightfold> so —user-install seems to install to 2.3.0 dir
dionysus70 has quit [Ping timeout: 252 seconds]
<havenwood> eightfold: so you're trying to use system Ruby to install gems locally?
<c-c> trying to install gems in ~/.gem
<eightfold> havenwood: i’m just trying to maintaining a working jekyll installation. not doing very well. not sure what is the right method.
<eightfold> —user-install seemed like a good idea
skryking has quit [Quit: Leaving]
elphe has joined #ruby
<c-c> eightfold: you can set --install-dir
<eightfold> and i guess i don’t want to use system ruby
<eightfold> as it’s old
<c-c> (I guess also should then --bindir)
<eightfold> i just want to do what works, K.I.S.S.
<eightfold> why —install-dir over —user-install?
<c-c> I wonder why --user-isntall didn't work
<eightfold> ~/.gem seems like an ok dir
<c-c> eightfold: seems to me your best bet is to go through https://guides.rubygems.org/faqs/
<eightfold> i have ~/.gem/ruby/2.3.0/bin/
<eightfold> seems installation went there
<eightfold> with --user-install
<eightfold> i think i’ll end up using the docker installation of jekyll
<eightfold> seems i can’t maintain working installation
elphe has quit [Ping timeout: 245 seconds]
<c-c> Well, one must maintain couple of env variables in a shell session. If thats too complex, maybe stick to system gems.
<c-c> and yeah, sometimes it takes couple of hours just to get things in line with the env var conf
jcalla has quit [Remote host closed the connection]
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
eightfold has quit [Ping timeout: 268 seconds]
elphe has joined #ruby
oosehedaiphequag has joined #ruby
<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
xrexeon has quit [Read error: Connection reset by peer]
oosehedaiphequag is now known as aaaa
elphe has quit [Ping timeout: 240 seconds]
<kaleido> "weather"=>[{"id"=>800, "main"=>"Clear"}], but getting ["weather"]["main"] throws an error. what am i doing wrong to the hash after JSON.parse?
ravenousmoose has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
aaaa has left #ruby [#ruby]
<havenwood> kaleido: what's the error?
<kaleido> TypeError: no implicit conversion of String into Integer
<kaleido> [18] pry(main)> skies = parsed["weather"]["main"]
<kaleido> TypeError: no implicit conversion of String into Integer
<havenwood> kaleido: that usually means you have an Array when you think you have a Hash
<kaleido> hmm
<kaleido> so am i getting bogus json to put through JSON.parse i wonder
<havenwood> kaleido: What is?: parsed.class
<havenwood> kaleido: Array?
<kaleido> [20] pry(main)> parsed.class
<kaleido> => Hash
<havenwood> kaleido: then it's: parsed["weather"].class
<kaleido> wel shit it's an array
<kaleido> :D
<havenwood> kaleido: parsed["weather"].map { |weather| weather["main"] }
<kaleido> damned. thank you, sir!
tdy has joined #ruby
<kirun> I'm seeing something unexpected with respond_to_missing? : https://dpaste.de/9sgq
elphe has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
elphe has quit [Ping timeout: 245 seconds]
elcuervo has joined #ruby
mamantoha has joined #ruby
johnny56_ has quit [Ping timeout: 272 seconds]
sgen has quit [Ping timeout: 240 seconds]
mamantoha has quit [Ping timeout: 252 seconds]
Nicmavr has quit [Read error: Connection reset by peer]
sameerynho has quit [Ping timeout: 245 seconds]
Nicmavr has joined #ruby
ascarter has joined #ruby
polishdub has quit [Quit: leaving]
johnny56_ has joined #ruby
<havenwood> kirun: That seems like a CRuby-specific quirk that's reproducible with #method and #public_method.
<havenwood> kirun: Interestingly, CRuby, JRuby and TruffleRuby each have slightly different behavior here: https://gist.github.com/havenwood/679c6ad1dc018f0750389bd4c21abdc9
<havenwood> kirun: Note, with `foo.respond_to?('bar')` it'd be `:bar` across the board.
ellcs has quit [Ping timeout: 240 seconds]
hiroaki_ has quit [Ping timeout: 245 seconds]
<kirun> havenwood: Thanks for that. If every ruby does something different it means I'm not the crazy one for once.
laaron- has joined #ruby
laaron has quit [Ping timeout: 256 seconds]
duderonomy has joined #ruby
spacesuitdiver has quit [Ping timeout: 245 seconds]
ellcs has joined #ruby
marmotini_ has quit [Ping timeout: 252 seconds]
elphe has joined #ruby
<zenspider> rawr
elphe has quit [Ping timeout: 255 seconds]
<zenspider> kirun: it's just the first call that comes out as a string, it's not the value itself.
Tempesta has quit [Quit: See ya!]
<zenspider> that's a legit bug imo and should be filed on bugs.ruby-lang.org
sgen has joined #ruby
agent_white has quit [Quit: brb]
<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...
t0x has quit [Quit: Connection closed for inactivity]
eightfold has joined #ruby
mamantoha has joined #ruby
<zenspider> I was partially wrong... if you switch from "posts" to "a", it doesn't reproduce...