patrontechnosoft has quit [Remote host closed the connection]
<dminuoso>
Bish: add nil if you want to allow for the empty case.
<dminuoso>
Note that combinatorically this drastically explodes if you increase the array sizes here.
<dminuoso>
Because n!
<Bish>
yeah thats why i want to limit each array to 2
<Bish>
but that doesnt really help in Big-O i guess
<universa1>
why don't you cache those, that are actually requested?
<Bish>
because the first request will timeout already
<universa1>
1st request slow, following ones will be fast.
<Bish>
slow as in, gateway timeout
NeutronStarr has joined #ruby
<Bish>
which will disrupt the process the user is in, and each user has its own ids there so i cant cache them for al
<dminuoso>
?xy
<ruby[bot]>
it seems like you are asking for a specific solution to a problem, instead of asking about your problem. This often leads to bad solutions and increases frustration for you and those trying to help you. More: http://meta.stackexchange.com/a/66378
<Bish>
i dont know how to explain my problem better, ive given all information i can
ayonkhan_ has joined #ruby
ayonkhan has quit [Ping timeout: 260 seconds]
<Bish>
actually its one huge database query these ids will get inserted to
<Bish>
that one is slow
<Bish>
af
<universa1>
Bish: well, guessing here: you could move the "slow task" into a background job. if there is database query, it is probably the case, one could optimize either the query or the db to make it faster.
jaruga________ has quit [Quit: jaruga________]
<Bish>
i tried to optimize it , pretty hopeless
<Bish>
background job doesnt help.. because its a really user interactive thing
<Bish>
i would rather remove the feature
<Bish>
u can have a shot at the database query if u want :D
<universa1>
but with only seeing the arguments, it is basically impossible to actually help you.
<universa1>
and i'm not saying that i can actually can, but you are making it hard for others...
aruns_ has joined #ruby
<Bish>
well, so what u demand me to do?
<Bish>
u can have the database select, which is basicially the whole method
<Bish>
there is not much more
<Bish>
(the method just executes the query)
ur5us has quit [Remote host closed the connection]
<Bish>
and i already spent some time optimizing it.. which wasn't fun
<aruns_>
Hi, quick question, running Mac OS X 10.11.6 (El Capitan) on office MacBook, using FISH 2.4.0 as my shell, running RVM 1.29.1 and RVM does not seem to be overriding the default Ruby I have installed.
<universa1>
aruns_: rvm use 2.4.1 ?
<universa1>
aruns_: set default ruby in rvm?
<aruns_>
universa1: Yeah, I have 2.4.1 set as default Ruby under RVM
<aruns_>
I have rvm use default in my shell config
<aruns_>
I have sourced shell config, exited the shell and spawned a new shell instance
<aruns_>
Even restarted
<universa1>
aruns_: does rvm actually work? so rvm use 2.4.1 doesn't print some warning?
<aruns_>
universa1: It does not, no.
<aruns_>
I'm following pretty much the same steps that I do on my Ubuntu and Arch laptops at home
<aruns_>
So I'm guessing maybe it's an issue with the RVM installer for Mac
<universa1>
aruns_: so after you've run rvm use 2.4.1
<universa1>
aruns_: it is actually using the rvm 2.4.1 ruby? so which ruby points to rvm?
<aruns_>
Well actually I have 2.4.0 at the moment
<aruns_>
I am installing 2.4.1 now
<universa1>
aruns_: doesn't amtter
<aruns_>
But it has Using /Users/*nameofuser*/.rvm/gems/ruby-2.4.0
<aruns_>
Just doesn't override the default Ruby
<universa1>
aruns_: so just the default stuff isn't working... what is the output of rvm list ?
<aruns_>
I don't recall if I even got it working under Bash
<aruns_>
Testing that now
<aruns_>
But it worked fine on FISH on Ubuntu and Arch
<universa1>
aruns_: this is on a fresh terminal session?
<aruns_>
Yes.
<universa1>
aruns_: so: new terminal; rvm list; which ruby <-- this points to system ruby?
<universa1>
aruns_: just trying to understand the problem ;) not having any idea why or what might be botched
<aruns_>
Exactly.
<aruns_>
I'm also running RVM 1.29.1
<aruns_>
I recall reading that I migh thave to downgrade
<aruns_>
But want to eliminate other possible causes first
nanoz has joined #ruby
ur5us has joined #ruby
<aruns_>
As still waiting for RVM to install 2.4.1 :P
<aruns_>
OK so it works under Bash
<aruns_>
That's good to know at least.
Drakevr has quit [Changing host]
Drakevr has joined #ruby
PaulCape_ has quit [Ping timeout: 240 seconds]
milardovich has joined #ruby
sekmo has joined #ruby
PaulCapestany has joined #ruby
DoubleMalt has joined #ruby
milardovich has quit [Ping timeout: 258 seconds]
kryptoz has joined #ruby
arup_r has joined #ruby
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<zenspider>
more fish complaints about rvm...?
ddddddd has joined #ruby
<zenspider>
aruns_: eliminate rvm. that's the variable in common
<aruns_>
Wait something I haven't tried.
<aruns_>
Think I know what the issue is.
<zenspider>
using rvm
<aruns_>
No I use it at home and works fine.
<arup_r>
I am setting up an end to end test outside of my rails projects folder. I have couple of shell scripts to start rails and my frontend application. When in my shell I run `./bin/setup` manually no error. All good. When I am calling the same from my Rspec hook like %x[ ./bin/setup ] .. It is telling `rails not found`. Can anyone help me to fix this shell issue? Here I asked the same question with more description https://www.reddit.com/r/rails/comme
jphase has quit [Remote host closed the connection]
hkdsun has quit [Ping timeout: 260 seconds]
jphase has joined #ruby
jphase has quit [Ping timeout: 240 seconds]
aruns has quit [Ping timeout: 248 seconds]
anjen has joined #ruby
aruns has joined #ruby
iomotoko has quit [Quit: leaving]
mim1k has quit [Ping timeout: 260 seconds]
meshsmith has joined #ruby
meshsmith has joined #ruby
meshsmith has quit [Changing host]
mark_66 has quit [Quit: Leaving.]
GodFather has joined #ruby
tau has joined #ruby
pandaant has joined #ruby
mim1k has joined #ruby
knight33 has joined #ruby
pandaant has quit [Remote host closed the connection]
ledestin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
agent_white has quit [Quit: bai]
ascarter has joined #ruby
ledestin has joined #ruby
BSAlb has joined #ruby
GodFather has quit [Quit: Ex-Chat]
GodFather has joined #ruby
GodFather has quit [Remote host closed the connection]
GodFather_ has joined #ruby
ascarter has quit [Ping timeout: 248 seconds]
ledestin has quit [Ping timeout: 248 seconds]
BSaboia has quit [Ping timeout: 268 seconds]
Danny has joined #ruby
Danny has quit [Remote host closed the connection]
antgel has quit [Ping timeout: 268 seconds]
antgel has joined #ruby
anisha has quit [Read error: Connection reset by peer]
jak_ has quit [Remote host closed the connection]
jak_ has joined #ruby
anisha has joined #ruby
uZiel has joined #ruby
nanoz has quit [Ping timeout: 268 seconds]
meshsmith has quit [Ping timeout: 276 seconds]
Hess has joined #ruby
xMopxShell has joined #ruby
mostlybadfly has quit [Quit: Connection closed for inactivity]
AckZ has joined #ruby
patarr has joined #ruby
anjen has quit [Quit: anjen]
uZiel has quit [Ping timeout: 248 seconds]
meshsmith has joined #ruby
meshsmith has joined #ruby
meshsmith has quit [Changing host]
knight33 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
xrlk has joined #ruby
mark_66 has joined #ruby
oleo has joined #ruby
<manveru>
anyone know how to tell rubocop not to complain about /(?<var>)/ =~ "something" ... it wants to replace it with Regexp#match? which won't assign the variable :(
<manveru>
so after this line the config_key variable has what i need already
<darix>
uhm
<darix>
ugly :p
<manveru>
it works with .match() as well, just not with .match?() :)
<darix>
manveru: sure but .match should return nil if it doesnt match no?
<manveru>
sure, but then one line becomes 3
<darix>
hm
<darix>
why?
<darix>
next unless mo = /^BEETLE_(?<config_key>.*)/.match(key)
<darix>
mo[:config_key]
<darix>
to access it
<darix>
or
<herwin>
which results in another rubocop warning
<darix>
mo = /^BEETLE_(?<config_key>.*)/.match(key)
<manveru>
assign in conditional
<herwin>
assignment in if-statement, or whatever the exact name they use is
<darix>
next if mo.nil?
<manveru>
either way, it's a bug in rubocop
<manveru>
that check is meant for better performance, not to change the semantics
<manveru>
there's just no new release yet... so i'll ignore it until then
gts7 has joined #ruby
cam27 has joined #ruby
Ishido has joined #ruby
shinnya has joined #ruby
aupadhye has quit [Ping timeout: 248 seconds]
KeyJoo has joined #ruby
zacts has joined #ruby
knight33 has joined #ruby
polishdub has joined #ruby
petruff has joined #ruby
cpruitt has joined #ruby
mim1k has quit [Ping timeout: 248 seconds]
mim1k has joined #ruby
ta_ has quit [Remote host closed the connection]
DLSteve has joined #ruby
cschneid_ has quit [Remote host closed the connection]
mim1k has quit [Ping timeout: 260 seconds]
hutch34 has joined #ruby
ferr has quit [Quit: WeeChat 1.8]
uZiel has joined #ruby
dionysus69 has quit [Ping timeout: 248 seconds]
alex`` has quit [Quit: WeeChat 1.8]
aufi has quit [Ping timeout: 248 seconds]
truenito has joined #ruby
GodFather_ has quit [Ping timeout: 260 seconds]
lxsameer has joined #ruby
GodFather_ has joined #ruby
tau has quit [Read error: Connection reset by peer]
tau has joined #ruby
jphase_ has joined #ruby
anisha has quit [Quit: This computer has gone to sleep]
cdg has joined #ruby
hightower2 has quit [Ping timeout: 276 seconds]
cadillac__ has joined #ruby
jphase has quit [Ping timeout: 276 seconds]
cadillac_ has quit [Read error: Connection reset by peer]
cadillac__ is now known as cadillac_
KeyJoo has quit [Ping timeout: 248 seconds]
nofxx has quit [Ping timeout: 240 seconds]
isBEKaml has joined #ruby
nofxx has joined #ruby
ketan has joined #ruby
skweek has joined #ruby
patarr_ has joined #ruby
vuoto has joined #ruby
conta has quit [Ping timeout: 276 seconds]
mathys has quit [Quit: Leaving]
skweek has quit [Ping timeout: 240 seconds]
patarr has quit [Ping timeout: 240 seconds]
Miah_ has joined #ruby
cschneid_ has joined #ruby
<Bish>
is there a reduce function that always calls the block with the same reference?
<Bish>
it feels stupid always to write .reduce {|a,b| ...;a}
mim1k has joined #ruby
<Bish>
it feels stupid always to write .reduce() {|a,b| ...;a}
<matthewd>
Bish: each_with_object
<Bish>
each_with_object.reduce or just each with object?
<ljarvis>
just the latter as matthewd suggested
<ljarvis>
.reduce { .. ;x } is a code smell
<ljarvis>
and it's exactly what each_with_object is for
<Bish>
ah okay
<ljarvis>
you can also chain it with just .with_object
<ljarvis>
e.g. .each.with_object
knight33 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
knight33 has joined #ruby
ResidentBiscuit has joined #ruby
patarr_ has quit [Ping timeout: 260 seconds]
patarr has joined #ruby
vuoto has quit [Remote host closed the connection]
vuoto has joined #ruby
Hess has quit [Ping timeout: 255 seconds]
zanshin has joined #ruby
noob has joined #ruby
doublemalt_ has joined #ruby
<zanshin>
I inherited some Ruby code that I'm trying to figure out. The code reads a JSON file and at one point has an if statement that reads `if i['ssl']` where `i` is the iterator and `ssl` is an attribute in the JSON file. ssl has a text value, it is _not_ a boolean. How does this if statement work? Does Ruby have some syntax sugar that treats the presence of a value as true?
noob has left #ruby [#ruby]
<apeiros>
zanshin: in ruby, everything except nil and false are true-ish
<apeiros>
i.e. if i['ssl'] is basically "if there's a value around for this key"
<ljarvis>
false is a value *troll*
<apeiros>
(would need a change if nil or false was a valid value for that key)
<apeiros>
and yes, that *troll* is not really a troll IMO
<apeiros>
true, false, nil are all objects in ruby. it's something to be aware of.
<zanshin>
apeiros: Lovely. Thanks. That's a new concept for me. I can go home now, I learned something new. :)
<ljarvis>
but yeah, if you want to check if "ssl" exists as a key, no matter what value it has, use .key?("ssl")
DoubleMalt has quit [Ping timeout: 255 seconds]
<apeiros>
I love has_ free syntax in ruby, but for this I actually prefer has_key? over key?
<zanshin>
has_key would be a lot clearer for the next guy who has to read and understand this.
<ljarvis>
tbh i just prefer key? because it's shorter, i do agree has_key? reads significantly better
hutch34 has quit [Ping timeout: 240 seconds]
GodFather_ has quit [Ping timeout: 260 seconds]
cdg has quit [Remote host closed the connection]
[Butch] has joined #ruby
<isBEKaml>
I think key? is better over the has_key? noise. To my eyes, key? just means asking 'is it a key?'
<ljarvis>
but has_key? is asking "has it got this key?" which is clearer :D
andikr has quit [Remote host closed the connection]
Qchmqs has quit [Remote host closed the connection]
<ljarvis>
we could also use: member? include?
<ljarvis>
lolruby
<isBEKaml>
well, you're using the hash. So that's implicit (or explicit): hash.key? 'foo' just asks 'is foo a key in this hash?'
<apeiros>
isBEKaml: foo.key? asks whether foo is a key IMO. it's why I don't like it.
<ljarvis>
no, you dont want to consider foo being a key
<apeiros>
he wants to know whether foo *has* a key given as a parameter
<ljarvis>
it's obviously a hash
patarr has quit [Ping timeout: 255 seconds]
<apeiros>
anyway, tbh, I'd even be fine with key? if in turn ruby got rid of all unnecessary aliases (there are some necessary ones)
<isBEKaml>
apeiros: Nope, that's not what I meant. I think you got it backwards to what I meant.
cdg has joined #ruby
<isBEKaml>
I meant something like: puts "foo is a key in some_hash" if some_hash.key? 'foo'
brent__ has joined #ruby
<apeiros>
yes, I got that
<apeiros>
maybe you reread the scrollback ;-)
<isBEKaml>
apeiros: I went with what you said: foo.key? is not what I meant at all
texasmynsted has quit [Ping timeout: 260 seconds]
<apeiros>
k
brent___ has joined #ruby
brent__ has quit [Read error: Connection reset by peer]
patarr has joined #ruby
texasmynsted has joined #ruby
Rodya_ has quit [Remote host closed the connection]
enterprisey has joined #ruby
uZiel_ has joined #ruby
ar1a has joined #ruby
<isBEKaml>
Oh, I now see where I got sidetracked. Sorry for the noise.
jak_ has quit [Remote host closed the connection]
<apeiros>
np
gizmore has joined #ruby
uZiel_ has quit [Client Quit]
<ar1a>
can someone link me some info on passing functions as parameters? in some libraries i see yknow "foo { |bar| puts bar }" or whatever, i was wondering if there was any info for implementing that into my own code
jak_ has joined #ruby
<ar1a>
so i can write functions that take functions as a parameter :D
<apeiros>
ar1a: they're called "blocks"
<ar1a>
thanks
<apeiros>
and basically you do `yield(arg1, …)` to invoke a block passed to your method
<apeiros>
and block_given? to test whether one was passed
<ar1a>
not arg1()
<ar1a>
thanks, block is the buzzword i needed
<apeiros>
no, yield() calls the block
<ar1a>
ill go look stuff up :)
<apeiros>
yield(arg1, arg2) calls the block passing 2 arguments to it
<learner123>
elomatreb: Yeah, I know that... so, I already need to know the usage of a method to use for the type, right?
choke has quit [Ping timeout: 255 seconds]
<elomatreb>
Yes, since methods can do different things on different types. Typically the standard library is designed to avoid confusion (e.g. length *usually* does what you want on all applicable classes), but it's not guaranteed and third-party code doesn't make any guarantees
<learner123>
For example, I should already know that .upper is used for <string>.upper... not with <array>.upper or <hash>.upper.
<elomatreb>
Yes, since there obviously is no uppercase version of an Array ;)
johnson[m] has joined #ruby
Tagami[m] has joined #ruby
aidalgol has joined #ruby
heftig has joined #ruby
turt2live has joined #ruby
torarne has joined #ruby
intermo[m] has joined #ruby
dman[m] has joined #ruby
M107262[m] has joined #ruby
jonjits[m] has joined #ruby
voltai[m] has joined #ruby
kp666[m] has joined #ruby
KevinMGranger has joined #ruby
aviraldg has joined #ruby
testnick[m] has joined #ruby
el_ocho[m] has joined #ruby
velu_aon[m] has joined #ruby
sekmo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
conta3 has joined #ruby
gts7 has quit [Read error: Connection reset by peer]
frustrum has joined #ruby
<learner123>
Is it similar in other languages like Python?
frustrum has quit [Client Quit]
<learner123>
as much confusing or no?
cschneid_ has quit [Remote host closed the connection]
hutch34 has quit [Ping timeout: 255 seconds]
mim1k has quit [Ping timeout: 260 seconds]
govg has quit [Quit: leaving]
kangu0 has joined #ruby
<kangu0>
Pointer exists in Ruby?
<kangu0>
Why Pointer is required
svara has quit [Remote host closed the connection]
duderonomy has joined #ruby
svara has joined #ruby
<elomatreb>
learner123: This is probably the same in all languages
Beams has quit [Quit: .]
<learner123>
ok, thanks.
Ishido has quit [Ping timeout: 240 seconds]
troys is now known as troys_
BSAlb has quit [Quit: Leaving]
BSaboia has joined #ruby
truenito has quit [Ping timeout: 276 seconds]
tgragnato has quit [Quit: Sto andando via]
<splitshot>
kangu0, yes. Everything is a reference.
<kangu0>
How or why pointer or reference are useful
<kangu0>
splitshot
abhi56rai has joined #ruby
jak_ has quit [Remote host closed the connection]
jak_ has joined #ruby
Miah_ has quit [Quit: Connection closed for inactivity]
d^sh_ has joined #ruby
quobo has quit [Quit: Connection closed for inactivity]
<splitshot>
Not really sure what you mean by how is it useful... It lets you share a reference to data without copying it. So there are benefits to that, but you also need to be aware that's what happening.
d^sh has quit [Ping timeout: 260 seconds]
cdg has joined #ruby
<dminuoso>
<splitshot> kangu0, yes. Everything is a reference.
<dminuoso>
That part is completely hidden from you though.
cdg has quit [Remote host closed the connection]
<splitshot>
When you, for example, pass an object (reference) to a method, that method has access to *that object*, not a copy of it.
<dminuoso>
Ruby is pure pass-by-value.
<dminuoso>
But what you pass are pointers under the hood.
cdg has joined #ruby
ketan has quit [Remote host closed the connection]
<elomatreb>
Ruby isn't big with asynchronous inputs, unless you build something with threads yourself there is nothing like that in the standard libray
<ar1a>
no, a gem is fine :)
<ar1a>
like um... readline? i think
<ar1a>
ugh, idk
<ar1a>
it's not important, nvm
<dminuoso>
Oh you meant non-blocking reading from stdin?
<ar1a>
yeah!
<dminuoso>
Uhhh....
<ar1a>
sorry, does asynchronous != non-blocking?
<elomatreb>
Usually yes
<elomatreb>
Uh, other way around
<elomatreb>
<- fail
<dminuoso>
Just never heard "async" being used in the context of IO
<dminuoso>
:P
<ar1a>
my bad
<elomatreb>
Node uses it like that I think?
<dminuoso>
So yeah. readline
<dminuoso>
curses/ncurses.
<dminuoso>
Those kinds of bastarized and completely unusable libraries
<splitshot>
async i/o is a big deal
<dminuoso>
splitshot: i/o yes. but non-blocking stdin? not so much.
* splitshot
shrugs
<elomatreb>
But stdout yes, as demonstrated by old NPM
<dminuoso>
But I guess you could also do it the hardway and use #select ...
<dminuoso>
Not that it's something you likely want..
<ar1a>
can you guys code review this short module please
<ruby[bot]>
dminuoso: # => no block given (yield) (LocalJumpError) ...check link for more (https://eval.in/826738)
* dminuoso
gives upo
<elomatreb>
ar1a: Chained array access like in line 11 can be nasty to debug when one of the intermediate values is nil, since you just get a undefined method for nil and the line
<dminuoso>
^-
<dminuoso>
Denormalize your data.
<dminuoso>
And then normalize it!
<dminuoso>
For good measure.
<ar1a>
elomatreb: i had found that
<ar1a>
dminuoso: what does that mean?
<elomatreb>
If you *really* need to do deep access into an array like that Array#dig is really nice
<dminuoso>
ar1a: It's something Rubyists dont know about. And neither do API vendors.
<ar1a>
that seems like a lot of work for something this simple... Array#dig looks cool
<dminuoso>
Let's see if I'll trigger anyone with this.
<elomatreb>
You need to use machine learning, blockchains, and mongodb big data to normalize your data, obviously
<ar1a>
the answer ive been wanting!
ketan has quit [Ping timeout: 255 seconds]
<dminuoso>
elomatreb: fuck mongodb
conta3 has quit [Quit: conta3]
<dminuoso>
elomatreb: the other things I agree with though.
<dminuoso>
Sorry for my language, but that word always triggers ne,.
montanonic has joined #ruby
mim1k has joined #ruby
<elomatreb>
You can substitute for any other hip database to taste
__Yiota has joined #ruby
<dminuoso>
It makes MySQL look professional in comparison.
<ar1a>
dminuoso: its web scale!
<ar1a>
dminuoso: has set +b on !ar1a@*
<ar1a>
is that how irc hostnames work, i forget
conta2 has joined #ruby
__Yiota has quit [Client Quit]
mim1k has quit [Ping timeout: 255 seconds]
whippythellama has joined #ruby
anisha has joined #ruby
DTZUZU has joined #ruby
mostlybadfly has quit [Quit: Connection closed for inactivity]
ascarter has joined #ruby
cdg has quit [Remote host closed the connection]
<ar1a>
is it true ruby isnt truly multi-threaded
abhi56rai has quit [Quit: WeeChat 1.9]
PaulCapestany has quit [Quit: .]
<ar1a>
uses GIL or something
ltem has quit [Quit: Leaving]
abhi56rai has joined #ruby
cschneid_ has joined #ruby
<dminuoso>
ar1a: *GVL
<dminuoso>
ar1a: And it depends. It is multi-threaded.
<ar1a>
Global interpreter lock
<ar1a>
whats GVL?
<dminuoso>
Global VM lock.
<dminuoso>
Ruby hasn't been using an interpreter since 1.9.
<ar1a>
so its like java now?
<dminuoso>
ar1a: Not as sophisticated. But yeah.
<ar1a>
how is it different to an interpreter in ruby's case
ascarter has quit [Ping timeout: 240 seconds]
__Yiota has joined #ruby
<dminuoso>
ar1a: By compiling to bytecode first there's certain optimizations that can be made during compilation, that offset the slight overhead.
abhi56rai has quit [Client Quit]
<dminuoso>
ar1a: Ruby 3.0 will take that to new proportions (where you can pre-compile ruby code before shipping easily)
abhi56rai has joined #ruby
<ar1a>
ruby 3.0
<ar1a>
haven't they been promising that for years! :p
whippythellama has quit [Ping timeout: 255 seconds]
uZiel has quit [Ping timeout: 248 seconds]
cschneid_ has quit [Ping timeout: 258 seconds]
abhi56rai has quit [Client Quit]
__Yiota has quit [Ping timeout: 240 seconds]
Cohedrin_ has quit [Ping timeout: 246 seconds]
<dminuoso>
ar1a: But anyway. To answer your original questions, it's just the Ruby code (basically the entire C code) that is protected by the GVL.
zenguy_pc has joined #ruby
mim1k has joined #ruby
<dminuoso>
ar1a: I/O interaction with the kernel typically releases the GVL. Which means you always have concurrency, but with I/O (and a very select few other things) you also have parallelism.
<dminuoso>
So if you're doing CPU intensive stuff that does things in the Ruby GVL you will only get concurrency.
jphase has quit [Remote host closed the connection]
GinoMan2440 has quit [Ping timeout: 260 seconds]
jphase has joined #ruby
GinoMan1423 has quit [Remote host closed the connection]
jphase has quit [Ping timeout: 255 seconds]
whippythellama has quit [Ping timeout: 240 seconds]
jak has quit [Remote host closed the connection]
blackwind_123 has joined #ruby
mim1k has joined #ruby
andrzejku has joined #ruby
ta_ has joined #ruby
<ar1a>
yep
nofxx has joined #ruby
jak has joined #ruby
mim1k has quit [Ping timeout: 260 seconds]
petruff has quit [Ping timeout: 240 seconds]
psychicist__ has quit [Quit: Lost terminal]
ledestin has joined #ruby
yokel has quit [Ping timeout: 240 seconds]
raspado has joined #ruby
yokel has joined #ruby
dcunit3d has quit [Ping timeout: 240 seconds]
tomaw has quit [Read error: Connection reset by peer]
Ishido has quit [Ping timeout: 255 seconds]
psychicist__ has joined #ruby
montanonic has quit [Ping timeout: 248 seconds]
Ishido has joined #ruby
yokel has quit [Ping timeout: 255 seconds]
postmodern has joined #ruby
yokel has joined #ruby
mim1k has joined #ruby
anisha has quit [Quit: This computer has gone to sleep]
solocshaw has quit [Remote host closed the connection]
abrahampolishchu has joined #ruby
SeepingN has joined #ruby
whippythellama has joined #ruby
mim1k has quit [Ping timeout: 248 seconds]
Cohedrin_ has quit [Read error: Connection reset by peer]
Cohedrin_ has joined #ruby
oleo has quit [Read error: Connection reset by peer]
nhhc has joined #ruby
montanonic has joined #ruby
johnny56_ has joined #ruby
knight33 has joined #ruby
tomaw has joined #ruby
<_moep_>
hey, is this room the correct one, for questions about rbenv?
<ar1a>
i don't see why not
<havenwood>
_moep_: There isn't an #rbenv channel like #chruby or #rvm, so this is the closest.
<_moep_>
ok
mim1k has joined #ruby
<_moep_>
ok, I installed it in ~app like the doc at github
<havenwood>
?rbenv
<ruby[bot]>
Missing command under rbenv? Did you try `rbenv rehash`?
solocshaw has joined #ruby
<_moep_>
now I want to run my configurationmanagment tool and it should trigger rbenv (rbenv install …)
troys is now known as troys_
<_moep_>
and I get at user root the error "no such command install"
<havenwood>
_moep_: Show us the line that results in that?
<_moep_>
/home/app/.rbenv/bin/rbenv install 2.3.4
sekmo has joined #ruby
<havenwood>
_moep_: Is ruby-build installed?
<_moep_>
I also exported the path before export PATH="/home/app/.rbenv/bin:$PATH"
<_moep_>
yes
solocshaw has quit [Remote host closed the connection]
<havenwood>
_moep_: Maybe avoid the entangled command and use ruby-build directly: ruby-build 2.3.4 ~/local/ruby-2.3.4
brent__ has joined #ruby
<_moep_>
its working localy its just not working with my script
<_moep_>
(when i try it as user root)
mim1k has quit [Ping timeout: 240 seconds]
<havenwood>
_moep_: If you continue to have ruby-build issues, you can always use ruby-install to install for rbenv: ruby-install --latest --install-dir ~/.rbenv/versions/2.3.4 ruby 2.3.4
<havenwood>
_moep_: I'd not be surprised if rbenv scripts don't work as root. Is it only with root you're having trouble?
oleo has joined #ruby
<_moep_>
yes, with the app user I dont a the problem
<havenwood>
_moep_: So I'd suggest using ruby-build directly, hardcoding the path to install to, or use ruby-install for the same.
brent___ has joined #ruby
brent__ has quit [Read error: Connection reset by peer]
whippythellama has quit [Ping timeout: 240 seconds]
cpruitt has quit [Quit: cpruitt]
troys_ is now known as troys
patarr has quit [Ping timeout: 248 seconds]
solocshaw has quit [Ping timeout: 255 seconds]
Fysicus has joined #ruby
jphase has quit [Remote host closed the connection]
jphase has joined #ruby
mostlybadfly has joined #ruby
mim1k has joined #ruby
jphase has quit [Ping timeout: 246 seconds]
quobo has joined #ruby
<learner123>
If I pass parameters to methods, is it possible get the name of those parameters? For example, myvar = 12345 and calling mymethod (myvar) will print "myvar" instead of 12345.
SeepingN has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mim1k has quit [Ping timeout: 255 seconds]
al2o3-cr has joined #ruby
blackwind_123 has quit [Ping timeout: 246 seconds]
<Papierkorb>
learner123: No
ketan has joined #ruby
blackwind_123 has joined #ruby
cam27 has joined #ruby
Cohedri__ has quit [Ping timeout: 260 seconds]
ketan has quit [Ping timeout: 248 seconds]
enterprisey has joined #ruby
<learner123>
it's not possible, Papierkorb?
<learner123>
Hard to believe!
haylon has quit [Remote host closed the connection]
jak has quit [Remote host closed the connection]
<clemens3>
u can look at caller and parse the file find the line that invoked you method etc., big hack, but could get something
<Papierkorb>
learner123: No it's not. Variables only have names so you, the programmer, can access them in your code. The computer, after reading the source, couldn't call less.
<Papierkorb>
*couldn't care
jak has joined #ruby
<clemens3>
__FILE__
whippythellama has joined #ruby
<clemens3>
there is local_variables, but you want the external one from the caller
johnzorn has quit [Ping timeout: 240 seconds]
<Papierkorb>
Well of course, you can try hacking your way through. But those are: Hacks. Nothing that's "usually" possible, and in this case, not easy to do right.
<learner123>
OK, thanks.
Cohedrin_ has joined #ruby
<clemens3>
yes, what for do you need that?
SeepingN has joined #ruby
<learner123>
Are you asking me, clements3?
whippythellama has quit [Ping timeout: 260 seconds]
<clemens3>
yes, but not important, i guess was just some curiousity of yours
DLSteve has quit [Quit: All rise, the honorable DLSteve has left the channel.]
<learner123>
OK.
<learner123>
myvar = 123 then somehow calling and making "mymethod myvar" print "myvar" = 123.
<learner123>
mymethod() would have some way to print the parameter name and parameter value in it.
ascarter has joined #ruby
<learner123>
a=1, b=2, c=3, d=4..... then printalpha(a, b, c, d) --> then printalpha method would print: a=1, b=2, c=3, d=4
<clemens3>
i understand what you want, but why do you want that?
<learner123>
Oh...
<clemens3>
the idea is for the printalpha method to hide that information
<clemens3>
of what happened outside
<clemens3>
if you have def printalpha( a, b, c, d ) then you are closer already
<learner123>
In reality for my task, each of those parameters is an array with a lot of values.
<learner123>
So, I want the method to print the parameter name first and then a bunch of its values.
Cohedrin_ has quit [Read error: Connection reset by peer]
<clemens3>
if you have def printalpha(p, q, r, s)
<clemens3>
u want to print abcd or pqrs?
<learner123>
Of course, I have a few actual processing steps to do before printing those things.
<learner123>
(inside a method)
<learner123>
abcd
<clemens3>
because what is the value? you could give an additional parameter with the abcd names if you cared for printout
<clemens3>
then why not add another parameter with those names
<learner123>
That's what I was trying to do with no success.
ascarter has quit [Ping timeout: 260 seconds]
Cohedrin_ has joined #ruby
<clemens3>
but what is the service in printing out the variable names?
<clemens3>
you can do printalpha( [ "a", a, "b", b, "c", c, "d", d ] )
SeepingN has quit [Ping timeout: 248 seconds]
<clemens3>
and you have all the information inside the method
roshanavand has quit [Ping timeout: 255 seconds]
roshanavand has joined #ruby
<learner123>
service = I want to create files with the parameter names that are part of the filenames.... and each file would include values of each parameter.
<learner123>
ah... let me try. Thanks, clements3!
<clemens3>
mom
<learner123>
actually, I'm using an myarray.each { |myparam| printalpha myparam }.
<clemens3>
al2o3-cr: i understood you wanted: a=1; foo(a); and output "a=1" and not "x=1"?
mim1k has quit [Ping timeout: 246 seconds]
<clemens3>
you=learner
<learner123>
I'm getting an error:
<learner123>
./test.rb:4:in `block in foo': undefined method `local_variable_get' for #<Binding:0x007fac6c87f8c8> (NoMethodError) from ./test.rb:4:in `map' from ./test.rb:4:in `foo' from ./test.rb:8:in `<main>'
TomyLobo has quit [Ping timeout: 255 seconds]
<learner123>
It's to al2o3-cr.
phreakocious_ is now known as phreakocious
<learner123>
clements3: Yep, that's what I'm trying to do.
<learner123>
Although my parameter is an array of arrays.
<clemens3>
but i dont understand the use case yet
<clemens3>
this files and parameters business
<clemens3>
because when you invoke the method, you have already the variable names there
<clemens3>
then what is the problem
<clemens3>
and what is it for
<clemens3>
maybe u can solve main problem differently
<clemens3>
learner, you can use al2o3's appraoch before invoking the sub method
<al2o3-cr>
i'm tired and probably didn't read the backlog enough :(
whippythellama has quit [Ping timeout: 240 seconds]
<zenspider>
learner123: don't do that
<learner123>
I thought this would be very simple.
<learner123>
why not?
<clemens3>
i guess it is some exercise from some class
<learner123>
No.
<zenspider>
don't paste a blob of crap in here. use a paste service. because it is polite
<learner123>
Let me modify it to make it closer to what I'm trying to do.
<zenspider>
and yes, you probably thought thit would be simple. it isn't. and it isn't a good idea for a number of reasons... but you should answer our questions first
<learner123>
What's the paste service?
<zenspider>
use a gist
<learner123>
OK, thanks. Let me check gist.
<clemens3>
learner123: you think you tell us what you do, but actually you are thinking how to do something.
pitoucc has joined #ruby
aglorei has quit [Remote host closed the connection]
<learner123>
Sorry for the cumbersome newbie code.
pitoucc has quit [Quit: Leaving]
<learner123>
But the above creates filenames "[1, 2, 3, 4]", "[5, 6, 7, 8]", etc.
PaulCapestany has quit [Read error: Connection reset by peer]
<learner123>
instead of filenames /tmp/array1, /tmp/array2, /tmp/array3.
hkdsun has joined #ruby
hkdsun_ has quit [Ping timeout: 258 seconds]
dcunit3d has joined #ruby
johnny56_ has quit [Ping timeout: 264 seconds]
<clemens3>
so the file name should be "array1" and the content of the file should be "[ 1, 2, 3, 4 ]"?
<clemens3>
etc for 2, 3, 4 as well
<learner123>
clements3: Yep, exactly.
PaulCapestany has joined #ruby
<learner123>
Right now, what I get is /tmp/[1, 2, 3, 4] as the filename instead of /tmp/array1.
johnny56_ has joined #ruby
<clemens3>
def write( filename, content )
<learner123>
I've googled various stack overflow sites, etc. and seen the use of .binding(), local_variable_get(), eval(), inspect(), etc. but with my ruby v2.0, some are not available and others just don't work for me.
mim1k has joined #ruby
ablackack has quit [Quit: ZNC 1.6.3+deb1+xenial0 - http://znc.in]
<learner123>
clements3: Hmm.... sorry but could you please show me a modified code using gist, if possible?
<clemens3>
File.write( "tmp/array1", array1 )
ablackack has joined #ruby
<learner123>
For one parameter, I could do that... how would I be able to do it when I had 10 parameters to pass.
<learner123>
Tricky to me with myarraynames.each { |myparam| mymethod myparam }