baweaver changed the topic of #ruby to: Rules & more: https://ruby-community.com | Ruby 2.5.1, 2.4.4, 2.3.7, 2.6.0-preview1: https://www.ruby-lang.org | Paste 4+ lines of text to https://gist.github.com | Rails questions? Ask in #RubyOnRails | Books: https://goo.gl/wpGhoQ | Logs: https://irclog.whitequark.org/ruby
kapil___ has quit [Quit: Connection closed for inactivity]
jenrzzz has quit [Ping timeout: 252 seconds]
karapetyan has quit []
Axy has quit [Read error: Connection reset by peer]
ramfjord has joined #ruby
BTRE has quit [Quit: Leaving]
cagomez has quit [Remote host closed the connection]
cagomez has joined #ruby
plexigras has quit [Ping timeout: 240 seconds]
shinnya has quit [Ping timeout: 256 seconds]
marr has quit [Ping timeout: 245 seconds]
cagomez has quit [Ping timeout: 245 seconds]
rivalomega has quit [Remote host closed the connection]
jcarl43 has quit [Quit: WeeChat 2.1]
moss has left #ruby ["WeeChat 2.1-dev"]
BTRE has joined #ruby
mistym- is now known as mistym
mistym has quit [Changing host]
mistym has joined #ruby
cagomez has joined #ruby
darkhanb has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cagomez has quit [Ping timeout: 245 seconds]
clemens3 has quit [Ping timeout: 245 seconds]
clemens3_ has quit [Ping timeout: 240 seconds]
dviola has quit [Ping timeout: 260 seconds]
t0xik has joined #ruby
raul782 has quit [Remote host closed the connection]
houhoulis has joined #ruby
yaewa has joined #ruby
moei has quit [Ping timeout: 252 seconds]
kapil___ has joined #ruby
jamesaxl has quit [Quit: WeeChat 2.1]
alfiemax has joined #ruby
raynold has joined #ruby
alfiemax has quit [Ping timeout: 252 seconds]
ciscam has quit [Ping timeout: 245 seconds]
<pizzaops> Is there a straightforward way to do a regex match against a string, and save everything *after* the match to a variable. For example...
thapakazi has joined #ruby
<pizzaops> Given a regex of `\/CN=` and a string of `/OU=Domain Control Validated/CN=*.google.com`, save `*.google.com*` to a variable.
<pizzaops> The trailing * in the last backticked-item is a typo.
ciscam has joined #ruby
bmurt has joined #ruby
yaewa has quit [Quit: Leaving...]
<elomatreb> String#split can use a regex as a pattern, but are you sure you can't adapt your regex to give you a matching group? Seems cleaner
moei has joined #ruby
<elomatreb> I.e. `\/CN=(.+)`, in your example
<pizzaops> Yeah I think I can do this: 'foo'.match(/f(.*)/).captures
<pizzaops> that returns `oo`
<pizzaops> and in this case it will always be everything after the match so that's safe
<pizzaops> elomatreb: thanks for being my rubber duck :)
<elomatreb> There's plenty of ways of doing that, I like "foo"[/f(.*)/, 1]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
raul782 has joined #ruby
white_lilies has joined #ruby
ur5us has joined #ruby
raul782 has quit [Ping timeout: 260 seconds]
lxsameer has joined #ruby
claw has quit [Ping timeout: 245 seconds]
dionysus69 has quit [Ping timeout: 252 seconds]
claw has joined #ruby
ur5us has quit [Remote host closed the connection]
alfiemax has joined #ruby
<baweaver> pizzaops: with semi-structured data like that you want to probably go more towards tokenization.
<baweaver> or splitting really
<baweaver> split by /, then split all those by =
<baweaver> >> '/OU=Domain Control Validated/CN=*.google.com'.split('/').map { |v| v.split('=') }.to_h
<ruby[bot]> baweaver: # => wrong array length at 0 (expected 2, was 0) (ArgumentError) ...check link for more (https://eval.in/1008444)
<baweaver> right, first is blank
<baweaver> >> '/OU=Domain Control Validated/CN=*.google.com'.split('/').reject(&:empty?).map { |v| v.split('=') }.to_h
<ruby[bot]> baweaver: # => {"OU"=>"Domain Control Validated", "CN"=>"*.google.com"} (https://eval.in/1008445)
<baweaver> Now you have accessible data with names on it to make things clearer.
alfiemax has quit [Ping timeout: 245 seconds]
<baweaver> regex risks missing parts of the data if you forget valid usecases. If a program or config is kind enough to stick to a given format, use that when parsing it. Regex is a last resort
<elomatreb> This looks like certificate parsing anyway, so "missing valid usecases" is kind of the name of the game
<baweaver> RFC reading is when it gets into Regex dark territory
ramfjord has quit [Ping timeout: 252 seconds]
ramfjord has joined #ruby
ramfjord has quit [Ping timeout: 260 seconds]
ramfjord has joined #ruby
ramfjord has quit [Ping timeout: 252 seconds]
herbmillerjr has joined #ruby
jamiejackson has joined #ruby
ramfjord has joined #ruby
ramfjord has quit [Ping timeout: 260 seconds]
lxsameer has quit [Ping timeout: 245 seconds]
orbyt_ has joined #ruby
<eam> but all the tokenizers use a regex for each element
linetrace has quit [Ping timeout: 248 seconds]
rkazak has joined #ruby
houhoulis has quit [Ping timeout: 252 seconds]
ogres has joined #ruby
jsrtr has quit [Ping timeout: 260 seconds]
pilne has quit [Quit: Leaving]
uplime is now known as klime
cyberg has quit [Quit: Leaving]
klime is now known as uplime
cadillac_ has quit [Quit: I quit]
cadillac_ has joined #ruby
coderphive has joined #ruby
ciscam has quit [Ping timeout: 260 seconds]
ciscam has joined #ruby
kapil___ has quit [Quit: Connection closed for inactivity]
alfiemax has joined #ruby
white_lilies has quit [Ping timeout: 260 seconds]
raul782 has joined #ruby
cadillac_ has quit [Read error: Connection reset by peer]
alfiemax has quit [Ping timeout: 248 seconds]
cadillac_ has joined #ruby
raul782 has quit [Ping timeout: 252 seconds]
thapakazi has quit [Quit: thapakazi]
goez has joined #ruby
rivalomega has joined #ruby
gix- has joined #ruby
gix has quit [Disconnected by services]
alfiemax has joined #ruby
minimalism has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jsrtr has joined #ruby
fsmauri21 has joined #ruby
rivalomega has quit [Read error: Connection reset by peer]
rivalome_ has joined #ruby
apeiros has joined #ruby
donofrio has quit [Remote host closed the connection]
skryking_ has quit [Quit: Leaving]
rkazak has quit [Quit: Sleep.....ing....]
skryking has joined #ruby
thapakazi has joined #ruby
thapakazi_ has joined #ruby
kmurphy4 has quit [Quit: kmurphy4]
raul782 has joined #ruby
kapil___ has joined #ruby
darkhanb has joined #ruby
raul782 has quit [Ping timeout: 248 seconds]
zapata has joined #ruby
gnufied has quit [Ping timeout: 252 seconds]
coderphive has quit [Quit: coderphive]
sudorobo has quit [Quit: ¯\_(ツ)_/¯]
sudorobo has joined #ruby
sudorobo has joined #ruby
gnufied has joined #ruby
ramfjord has joined #ruby
raul782 has joined #ruby
Hobbyboy has quit [Ping timeout: 256 seconds]
alfiemax has quit [Remote host closed the connection]
alfiemax has joined #ruby
ramfjord has quit [Ping timeout: 245 seconds]
raul782 has quit [Ping timeout: 264 seconds]
alfiemax has quit [Ping timeout: 256 seconds]
Hobbyboy has joined #ruby
paul_ has joined #ruby
howdoi has joined #ruby
reber has joined #ruby
alfiemax has joined #ruby
alex`` has joined #ruby
oleo has quit [Quit: Leaving]
anisha has joined #ruby
raul782 has joined #ruby
ogres has quit [Quit: Connection closed for inactivity]
jamiejackson has quit [Ping timeout: 252 seconds]
aupadhye has joined #ruby
raul782 has quit [Remote host closed the connection]
schleppel has joined #ruby
jrabe has quit [Quit: Disconnected]
jrabe has joined #ruby
sauvin has joined #ruby
conta has joined #ruby
DeepIO has joined #ruby
ciscam has quit [Ping timeout: 248 seconds]
ciscam has joined #ruby
paul_ has quit [Ping timeout: 245 seconds]
paul_ has joined #ruby
DeepIO has quit [Quit: KVIrc 5.0.0 Aria http://www.kvirc.net/]
apeiros has quit [Remote host closed the connection]
apeiros has joined #ruby
apeiros has quit [Ping timeout: 245 seconds]
biberu has joined #ruby
mtkd has joined #ruby
raul782 has joined #ruby
nkh^ has joined #ruby
mlkkk has joined #ruby
raul782 has quit [Ping timeout: 252 seconds]
mlkkk_ has joined #ruby
Mia has joined #ruby
Mia has joined #ruby
Mia has quit [Changing host]
roshanavand has quit [Ping timeout: 245 seconds]
suukim has joined #ruby
mlkkk has quit [Ping timeout: 245 seconds]
paul_ has quit [Ping timeout: 245 seconds]
mlkkk_ has quit [Remote host closed the connection]
mlkkk has joined #ruby
marius has quit [Quit: baj]
rcvalle has quit [Ping timeout: 245 seconds]
rcvalle has joined #ruby
marius has joined #ruby
raul782 has joined #ruby
jarnalyrkar has joined #ruby
mlkkk has quit [Ping timeout: 268 seconds]
apeiros has joined #ruby
fsmauri21 has quit [Quit: Leaving]
raul782 has quit [Remote host closed the connection]
raul782 has joined #ruby
yohji has joined #ruby
paul_ has joined #ruby
schleppel has quit [Quit: Konversation terminated!]
mikecmpbll has joined #ruby
nkh^ has quit [Ping timeout: 264 seconds]
rmerry is now known as Guest40880
clemens3_ has joined #ruby
amar_ has joined #ruby
mikecmpbll has quit [Quit: inabit. zz.]
amar_ has quit [Ping timeout: 252 seconds]
justizin has joined #ruby
amar_ has joined #ruby
ramfjord has joined #ruby
KeyJoo has joined #ruby
KeyJoo has quit [Max SendQ exceeded]
ramfjord has quit [Ping timeout: 245 seconds]
KeyJoo has joined #ruby
Torstein has joined #ruby
raul782 has quit [Remote host closed the connection]
claudiuinberlin has joined #ruby
dionysus69 has joined #ruby
arne has quit [Quit: leaving]
schleppel has joined #ruby
Bish has quit [Remote host closed the connection]
Mortomes has joined #ruby
ta_ has joined #ruby
darkhanb has quit [Ping timeout: 245 seconds]
Mortomes is now known as Mortomes|Work
Burgestrand has joined #ruby
clemens3 has joined #ruby
mrush has quit [Ping timeout: 276 seconds]
mrush has joined #ruby
mrush is now known as Guest20673
dinfuehr has quit [Ping timeout: 252 seconds]
dinfuehr has joined #ruby
t0xik has quit [Quit: Connection closed for inactivity]
amar_ has quit [Remote host closed the connection]
amar_ has joined #ruby
amar__ has joined #ruby
rivalome_ has quit [Read error: Connection reset by peer]
rivalomega has joined #ruby
amar_ has quit [Read error: Connection reset by peer]
armando has quit [Quit: ZNC 1.8.x-nightly-20180512-bc7a2176 - https://znc.in]
alfiemax_ has joined #ruby
alfiemax has quit [Ping timeout: 252 seconds]
armando has joined #ruby
huyderman has joined #ruby
raul782 has joined #ruby
mlkkk has joined #ruby
amar__ has quit [Remote host closed the connection]
tvw has joined #ruby
raul782 has quit [Ping timeout: 240 seconds]
amar_ has joined #ruby
duderonomy has quit [Ping timeout: 260 seconds]
mikecmpbll has joined #ruby
amar_ has quit [Remote host closed the connection]
tvw has quit []
saTchymoto has joined #ruby
pskosinski has quit [Ping timeout: 245 seconds]
pskosinski has joined #ruby
dionysus69 has quit [Ping timeout: 260 seconds]
VladGh_ has joined #ruby
VladGh has quit [Ping timeout: 256 seconds]
kapil___ has quit [Quit: Connection closed for inactivity]
marr has joined #ruby
cschnei__ has joined #ruby
cschneid has quit [Ping timeout: 248 seconds]
\void has quit [Quit: So long, and thanks for all the fish.]
amar_ has joined #ruby
guille-moe has joined #ruby
mtkd has quit [Ping timeout: 256 seconds]
mtkd has joined #ruby
alfiemax has joined #ruby
anikras has joined #ruby
alfiemax_ has quit [Ping timeout: 245 seconds]
tvw has joined #ruby
dionysus69 has joined #ruby
venmx has joined #ruby
amar_ has quit [Ping timeout: 252 seconds]
Mike11 has joined #ruby
alfiemax_ has joined #ruby
lxsameer has joined #ruby
alfiemax has quit [Ping timeout: 245 seconds]
dhollin3 has joined #ruby
Mia has quit [Read error: Connection reset by peer]
dhollinger has quit [Ping timeout: 260 seconds]
Hien has quit [Quit: leaving]
thapakazi has quit [Ping timeout: 245 seconds]
thapakazi_ has quit [Ping timeout: 260 seconds]
ciscam has quit [Ping timeout: 245 seconds]
ciscam has joined #ruby
Guest20673 has quit [Ping timeout: 260 seconds]
mrush has joined #ruby
Hien has joined #ruby
mrush is now known as Guest32769
anikras has quit [Read error: Connection reset by peer]
KeyJoo has quit [Ping timeout: 245 seconds]
thapakazi has joined #ruby
howdoi has quit [Quit: Connection closed for inactivity]
alfiemax_ has quit [Remote host closed the connection]
roshanavand has joined #ruby
raul782 has joined #ruby
ipe has joined #ruby
Guest32769 has quit [Ping timeout: 256 seconds]
ipee has joined #ruby
mikecmpbll has quit [Quit: inabit. zz.]
raul782 has quit [Ping timeout: 256 seconds]
mrush_ has joined #ruby
KeyJoo has joined #ruby
ipe has quit [Ping timeout: 268 seconds]
mikecmpbll has joined #ruby
nayena has joined #ruby
apeiros has quit [Remote host closed the connection]
Guest82488 has joined #ruby
Guest82488 has quit [Quit: Mutter: www.mutterirc.com]
nowhere_man has quit [Ping timeout: 256 seconds]
nayena has quit [Ping timeout: 252 seconds]
apparition has joined #ruby
alfiemax has joined #ruby
alfiemax has quit [Read error: Connection reset by peer]
plexigras has joined #ruby
alfiemax has joined #ruby
amelliaa has joined #ruby
guille-moe has quit [Remote host closed the connection]
alfiemax_ has joined #ruby
alfiemax has quit [Ping timeout: 252 seconds]
amar_ has joined #ruby
guille-moe has joined #ruby
hfp_work has quit [Quit: bye]
raul782 has joined #ruby
ciscam has quit [Ping timeout: 252 seconds]
jamesaxl has joined #ruby
ciscam has joined #ruby
hfp_work has joined #ruby
raul782 has quit [Ping timeout: 260 seconds]
guille-moe has quit [Read error: Connection reset by peer]
guille-moe has joined #ruby
amatas has joined #ruby
guille-moe has quit [Remote host closed the connection]
amatas has quit [Quit: amatas]
guille-moe has joined #ruby
amatas has joined #ruby
kapil___ has joined #ruby
dionysus69 has quit [Ping timeout: 245 seconds]
guille-moe has quit [Quit: guille-moe]
joro_ has joined #ruby
tuskkk___ has left #ruby [#ruby]
lytol has quit [Read error: Connection reset by peer]
lytol has joined #ruby
warrshrike has joined #ruby
<warrshrike> hey
<warrshrike> how is everyone?
<warrshrike> how is everyone?
alfiemax has joined #ruby
dionysus69 has joined #ruby
Mike11 has quit [Ping timeout: 252 seconds]
<warrshrike> any ideas why this returns nil?
roshanavand has quit [Ping timeout: 260 seconds]
<tbuehlmann> warrshrike: it's either line 15 or line 23
alfiemax_ has quit [Ping timeout: 260 seconds]
<warrshrike> tbuehlmann: why would either of those lines cause issues? I mean 23 is just a return statement
<warrshrike> definitely not 15 - removed it and still nil
<canton7> warrshrike, 'head' might be nil
<canton7> in fact, head is guaranteed to be nil
<warrshrike> canton7: okay yeah youre right
raul782 has joined #ruby
<tbuehlmann> yeah, the while stops at head == nil
<warrshrike> that was dumb of me
<warrshrike> okay so whats the low down on call by reference vs value in ruby
<warrshrike> its clear its all happening by ref here - is that universal?
<canton7> ruby is pass-by-value, but everything is an object
<warrshrike> canton7: we pass around the objects, their addresses or copies of the objects?
<canton7> the references to the objects are passed around by value
raul782 has quit [Ping timeout: 245 seconds]
<tbuehlmann> it's pass by value, but we pass object references
<tbuehlmann> ^
beefjoe70 has joined #ruby
<warrshrike> tbuehlmann: so the value the object is storing is directly given to the asignee?
<warrshrike> and the object used to assign doesnt have any further relevance?
<canton7> no, a reference to the object is directly given to the assignee
<warrshrike> a = 7 b = a; object here means 7 right?
<canton7> yes. '7' is an object. a holds a reference to the '7' object. that reference to the same '7' object is then copied into b
<warrshrike> okay okay.
claw has quit [Ping timeout: 245 seconds]
<warrshrike> so if i do this: a = 7 b = a b = 9
<warrshrike> a is not changed right?
<canton7> correct. 'b = 9' creates a new '9' object, and assigns a reference to it to the 'b' variable
<warrshrike> but this: a = 'x', b = a, b = b.uppercase
arne_ has joined #ruby
<warrshrike> a is now uppercase?
<warrshrike> because method is called on same object?
claw has joined #ruby
<canton7> no, 'uppercase' does not mutate the object it was called on. It returns a new object.
<warrshrike> canton7: hmm okay but then
<arne_> what is a good way to path a value down the stack except parameters?
<warrshrike> how does line 22 in my example code paste alter the original list?
<canton7> 'upcase!' however does. If you did 'a = x; b = a; b.upcase!; then 'a' is now 'X'
<warrshrike> backpop[target-1].next = backpop[target+1]
<warrshrike> were skipping an element in the list here...i.e. removing it
<warrshrike> and this change is reflected in 'head'
<canton7> you're mutating backpop[target-1], by changing its 'next' property
<warrshrike> ah so it matters if the method is 'in place'?
<canton7> whether or not an object is mutated when a method is called depends on whether or not the method mutates the object it's called on, yes
<canton7> upcase does not mutate, upcase! does, see my example just above
<warrshrike> gotcha. like sort and sort!
<warrshrike> makes sense
<warrshrike> so its really call by value, but in some special cases the method may mutate the og obj/data structure
<canton7> "call by value"?
weird_error has joined #ruby
conta has quit [Quit: conta]
Puffball has quit [Ping timeout: 252 seconds]
aloy has quit [Quit: brb]
<warrshrike> canton7: my bad
<warrshrike> it passes objects
<warrshrike> i meanr
aloy has joined #ruby
<canton7> ruby passes references to objects by value
<canton7> those objects can be mutated (if they expose methods which mutate them)
ldnunes has joined #ruby
houhoulis has joined #ruby
beefjoe70 has quit [Remote host closed the connection]
jrafanie has joined #ruby
aloy has quit [Client Quit]
aloy has joined #ruby
arne_ has quit [Quit: leaving]
<warrshrike> canton7: goctha
dionysus69 has quit [Quit: dionysus69]
<warrshrike> so now it works more or less
<canton7> so it just returns the thing which was passed in?
<warrshrike> except for the corner cases where: [1,2], 1 and [1,2], 2
<warrshrike> canton7: no it makes edits
<warrshrike> it removes the element we are supposed to remove by assign prevs next to the one ahead of target...
<canton7> right, but it returns the thing which was passed in?
<warrshrike> canton7: yes. it returns the same list minus one element
<canton7> right
<warrshrike> the problem would be fairly trivial but im trying to do it in one pass...the trade off I chose is O(N) storage
raynold has quit [Quit: Connection closed for inactivity]
roshanavand has joined #ruby
<warrshrike> clearly the corner cases dont work because 0-1 is -1 and that returns nil from the array containing nodes...
<warrshrike> any ideas?
jrafanie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jrafanie has joined #ruby
jrafanie has quit [Client Quit]
conta has joined #ruby
Cavallari has joined #ruby
apparition has quit [Quit: Bye]
<warrshrike> please?
conta has quit [Quit: conta]
gregf_ has quit [Ping timeout: 260 seconds]
ta_ has quit [Remote host closed the connection]
Puffball has joined #ruby
<dminuoso> warrshrike: Ruby's execution model is call-by-value.
<dminuoso> This "pass-by-object" is some arbitrary made up terminology to refer to the fact that variables are in fact references to objects.
<warrshrike> dminuoso: thank goodness the expert is in the house!
<warrshrike> that makes sense
<warrshrike> so its pass by value
<warrshrike> unless the value itself is being mutated
<dminuoso> warrshrike: No.
<dminuoso> a = {}
alfiemax has quit [Remote host closed the connection]
<dminuoso> You have an Object or class Hash in your object space flying around.
<dminuoso> And you have a variable called "a" pointing at that object.
<dminuoso> You could say "a" contains a _reference_ to that object.
<warrshrike> okay go on...
<dminuoso> When you pass "a" around, you pass the _reference_ (like a pointer)
<dminuoso> Assignment changes the pointer.
<warrshrike> dminuoso: makes sense...
<warrshrike> a = 9, b = a, b = 10
vondruch_ has joined #ruby
<warrshrike> so now b points to a new 10 in memory
<warrshrike> and a is still pointing to 9
<dminuoso> warrshrike: forget integers they are too special
<dminuoso> warrshrike: Use arrays maybe
<warrshrike> a = Node(9), b = a, b = Node(10)
<warrshrike> how about linked lists?
<dminuoso> Sure
* canton7 wonders how many people have to say the exact same thing...
<warrshrike> Right so lets say a = HEAD
<dminuoso> warrshrike: are you familiar with C and pointers?
<warrshrike> dminuoso: yeah i am
<dminuoso> warrshrike: the `.` for methods can be thought of as ->
conta has joined #ruby
<dminuoso> warrshrike: and variables are pointers.
<warrshrike> dminuoso: okay....
<dminuoso> so if you do `a = b` you just copy pointers.
<warrshrike> but then how is it call by value
<warrshrike> in c++
<dminuoso> warrshrike: call-by-value is an execution model.
<warrshrike> this -> is thought of as call by ref
<warrshrike> no?
<dminuoso> warrshrike: call-by-value is an execution model.
<warrshrike> dminuoso: okay okay....
<warrshrike> that means its not relevant for the programmer?
vondruch has quit [Ping timeout: 256 seconds]
vondruch_ is now known as vondruch
<dminuoso> warrshrike: It is but not for this discussion.
<dminuoso> warrshrike: call-by-value means this:
<dminuoso> `f(1 + 2)` in this expression 1+2 is evaluated before f is applied to its argument.
<warrshrike> dminuoso: oh THAT call by value
<dminuoso> warrshrike: The reason this has a name is because other evaluation strategies exist. Applicative order, call-by-need, call-by-sharing
<warrshrike> but as for passing things around
<warrshrike> those are done by reference
<dminuoso> warrshrike: Nope
<dminuoso> warrshrike: It's C style pointers.
<dminuoso> warrshrike: ruby variables are just pointers
<dminuoso> The major difference is this:
<warrshrike> dminuoso: arent c style pointers by ref?
<dminuoso> warrshrike: nope.
<dminuoso> warrshrike: void f(int *a) { a = 0; }; int main() { int a = 5; foo(&a); printf("%d", a); }
<dminuoso> warrshrike: void foo(int *a) { a = 0; }; int main() { int a = 5; foo(&a); printf("%d", a); }
<dminuoso> warrshrike: would you agree that the assignment `a = 0` has no affect?
<kke> why no YAML.safe_load_stream?
<warrshrike> dminuoso: yes
Mortomes|Work has quit [Ping timeout: 260 seconds]
<warrshrike> unless we do this: f(int &a)
raul782 has joined #ruby
<dminuoso> warrshrike: When I use the word "references" I mean it in a generic "pointer" sense
<dminuoso> Not in the C++ sense.
<warrshrike> dminuoso: okay okay got it
<dminuoso> warrshrike: Ruby does not have reference semantics.
<dminuoso> All variables are pointers
<dminuoso> And ruby has pass-by-value semantics.
<warrshrike> dminuoso: so in C
alfiemax has joined #ruby
<warrshrike> if you do something like this: int i = 9; *int j = &i; j=*j+1
<warrshrike> wont this update i too?
<warrshrike> or am i thoroughly not making sense now? :P
raul782 has quit [Ping timeout: 248 seconds]
<dminuoso> warrshrike: Like I said, methods have -> semantics.
<dminuoso> So they dereference the pointer and let you mutate objects in place.
<dminuoso> >> a = [1,2,3]; a.pop; p a
<ruby[bot]> dminuoso: # => [1, 2] ...check link for more (https://eval.in/1008715)
* dminuoso goes back
<warrshrike> dminuoso: wow brilliant example
<warrshrike> and just like that
<warrshrike> everything was crystal clear
<warrshrike> so thats how linked lists work in ruby
<warrshrike> out of interest, is ruby built on c or something?
<warrshrike> also out of interest, is it just me or has this channel become wayy quiter
<warrshrike> haven't seen many of the regulars for a bit
<warrshrike> hope people haven't deserted to #python :P
mingming has joined #ruby
mingming has quit [Client Quit]
chef_byd has joined #ruby
dionysus69 has joined #ruby
dionysus69 has quit [Client Quit]
dionysus69 has joined #ruby
dionysus69 has quit [Client Quit]
roshanavand has quit [Ping timeout: 245 seconds]
mingming has joined #ruby
dionysus69 has joined #ruby
<kke> everything worth asking has been asked and you can find your answer quickly using google because of the amount of available material
rikkipitt has joined #ruby
alfiemax has quit [Remote host closed the connection]
<warrshrike> kke: no true, i just asked some illuminating questions
<warrshrike> kke: in seriousness you're probably right stackoverflow has becomes great and the amount of ruby info is very large but nonetheless
<warrshrike> i think there will never be a substitute for a personalized help
<warrshrike> i generally post my code snippets and ask for help :P
<warrshrike> I'll always be thankful to this channel they helped me during some dark nights
<warrshrike> and dangerous times
donofrio has joined #ruby
dionysus69 has quit [Client Quit]
dionysus69 has joined #ruby
donofrio_ has joined #ruby
<kke> there's no answer to my earlier question either.
<warrshrike> kke: perhaps not a worthwhile question....
chef_byd has quit [Ping timeout: 245 seconds]
<kke> there's YAML.parse_stream which returns stuff like Psych::Nodes::Document, which each have .to_ruby and .to_yaml. i thought i maybe could have done something like YAML.safe_load(doc.to_yaml) but the .to_yaml raises RuntimeError (expected STREAM-START)
donofrio has quit [Ping timeout: 268 seconds]
AJA4350 has joined #ruby
brendan- has joined #ruby
<kke> i guess i need to split the yaml myself
<kke> or be unsafe, i guess that's an option, as my app also processes .erb
coderphive has joined #ruby
houhoulis has quit [Remote host closed the connection]
Cavallari has quit [Quit: Cavallari]
mingming has quit [Quit: WeeChat 0.3.7]
vondruch has quit [Quit: vondruch]
warrshrike has quit [Quit: Page closed]
vondruch has joined #ruby
thapakazi has quit [Quit: thapakazi]
coderphive has quit [Ping timeout: 252 seconds]
rikkipitt has quit [Quit: Leaving...]
banisterfiend has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
alfiemax has joined #ruby
Puffball has quit [Quit: Puffball]
dviola has joined #ruby
ramfjord has joined #ruby
raul782 has joined #ruby
pabs has quit [Ping timeout: 245 seconds]
ramfjord has quit [Ping timeout: 256 seconds]
raul782 has quit [Ping timeout: 264 seconds]
paul_ has quit [Ping timeout: 268 seconds]
k0mpa has joined #ruby
jarnalyrkar has quit [Quit: Leaving]
pabs has joined #ruby
k0mpa has quit [Remote host closed the connection]
alfiemax_ has joined #ruby
ta_ has joined #ruby
alfiemax has quit [Ping timeout: 264 seconds]
guille-moe has joined #ruby
bmurt has joined #ruby
Asher has quit [Ping timeout: 260 seconds]
alfiemax_ has quit [Remote host closed the connection]
tomeaton17 has quit [Quit: ZNC 1.7.0 - https://znc.in]
tomeaton17 has joined #ruby
alfiemax has joined #ruby
Azure has quit [Read error: Connection reset by peer]
raul782 has joined #ruby
Azure has joined #ruby
guille-moe has quit [Remote host closed the connection]
amar_ has quit [Remote host closed the connection]
raul782 has quit [Remote host closed the connection]
raul782 has joined #ruby
amar_ has joined #ruby
guille-moe has joined #ruby
amar_ has quit [Remote host closed the connection]
roshanavand has joined #ruby
rivalomega has quit [Remote host closed the connection]
ta_ has quit [Remote host closed the connection]
Asher has joined #ruby
alfiemax has quit [Remote host closed the connection]
pastorinni has joined #ruby
ta_ has joined #ruby
Asher has quit [Ping timeout: 260 seconds]
raul782 has quit [Remote host closed the connection]
raul782 has joined #ruby
Asher has joined #ruby
alex`` has quit [Quit: WeeChat 2.1]
thapakazi has joined #ruby
TheBrayn has quit [Ping timeout: 256 seconds]
alex`` has joined #ruby
Rapture has joined #ruby
jrafanie has joined #ruby
Asher has quit [Ping timeout: 240 seconds]
Asher has joined #ruby
Mike11 has joined #ruby
alfiemax has joined #ruby
dionysus69 has quit [Remote host closed the connection]
vondruch_ has joined #ruby
Asher has quit [Ping timeout: 245 seconds]
ramfjord has joined #ruby
dionysus69 has joined #ruby
pastorinni has quit [Read error: Connection reset by peer]
pastorinni has joined #ruby
lightstalker has joined #ruby
dhollin3 is now known as dhollinger
Asher has joined #ruby
vondruch has quit [Ping timeout: 245 seconds]
vondruch_ is now known as vondruch
TheBrayn has joined #ruby
alfiemax has quit [Ping timeout: 256 seconds]
ramfjord has quit [Ping timeout: 260 seconds]
vulgrin has quit [Quit: WeeChat 2.1]
amar has joined #ruby
amar has quit [Read error: No route to host]
amar has joined #ruby
amar has quit [Remote host closed the connection]
roshanavand has quit [Ping timeout: 245 seconds]
trautwein has quit [Quit: ZNC 1.6.6 - http://znc.in]
trautwein has joined #ruby
oleo has joined #ruby
saTchymoto has quit []
guille-moe has quit [Remote host closed the connection]
guille-moe has joined #ruby
mtkd has quit []
aupadhye has quit [Ping timeout: 245 seconds]
rivalomega has joined #ruby
mikecmpbll has quit [Remote host closed the connection]
mtkd has joined #ruby
rivalomega has quit [Ping timeout: 260 seconds]
p0s1x has joined #ruby
znz_jp has quit [Remote host closed the connection]
jrafanie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jrafanie has joined #ruby
grilix has joined #ruby
alfiemax has joined #ruby
znz_jp has joined #ruby
roshanavand has joined #ruby
shinnya has joined #ruby
alfiemax has quit [Remote host closed the connection]
biberu has quit []
p0s1x has quit [Quit: Segmentation fault]
heyimwill has quit [Ping timeout: 256 seconds]
Inside has joined #ruby
sundhell_away has quit [Ping timeout: 276 seconds]
raul782 has quit [Remote host closed the connection]
<Inside> Hey folks. I have a Gemfile with some gems called out.. I've pushed the project to github and github is warning me that some of the dependent gems have security issues. How do I explicitly update those without putting them in the Gemfile?
parzydeuko has joined #ruby
krasnus has quit [Ping timeout: 256 seconds]
jamiejackson has joined #ruby
emilford has joined #ruby
orbyt_ has joined #ruby
kmurphy4 has joined #ruby
dionysus69 has quit [Ping timeout: 252 seconds]
pastorin_ has joined #ruby
pastorinni has quit [Read error: Connection reset by peer]
raul782 has joined #ruby
guille-moe has quit [Quit: guille-moe]
raul782 has quit [Remote host closed the connection]
guille-moe has joined #ruby
raul782 has joined #ruby
huyderman has quit [Remote host closed the connection]
<havenwood> Inside: Github looks at the Gemfile.lock. Try updating those gems in the Gemfile.lock by running: bundle update GEM_NAME --conservative
<havenwood> With GEM_NAME being the name of the gem Github is complaining about.
<havenwood> Inside: Why don't you want to update the Gemfile, by the way?
<havenwood> (You don't need to, unless you've pinned gems to versions that are too low.)
vondruch has quit [Quit: vondruch]
<Inside> I see :D
<Inside> Yeah - I realized that I could just update them individually D:
<Inside> havenwood: well, I don't want to be specifying gem revisions for gems that I'm not directly using in my Gemfile
raul782 has quit [Remote host closed the connection]
<havenwood> Inside: You might put a comment by it that it's to ensure a CVE is patched. You may be able to update gems that depend on it so you don't have to mention it directly.
jrafanie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<havenwood> Inside: It's the version in the Gemfile.lock that matters.
rippa has joined #ruby
jrafanie has joined #ruby
Torstein has quit [Ping timeout: 260 seconds]
rivalomega has joined #ruby
kmurphy4 has quit [Quit: kmurphy4]
chouhoulis has joined #ruby
pappi has joined #ruby
pappi has quit [Client Quit]
vondruch has joined #ruby
vondruch has quit [Client Quit]
vondruch has joined #ruby
krasnus has joined #ruby
kmurphy4 has joined #ruby
kmurphy4 has quit [Client Quit]
<z4phod> hello ! :)
<z4phod> someone are using rack-mini-profiler in production ?
duderonomy has joined #ruby
shinnya has quit [Ping timeout: 264 seconds]
raul782 has joined #ruby
jamiejackson has quit [Ping timeout: 260 seconds]
Bonjourm8 has joined #ruby
Dbugger has joined #ruby
_aeris_ has quit [Remote host closed the connection]
_aeris_ has joined #ruby
tvw has quit [Remote host closed the connection]
raul782 has quit [Remote host closed the connection]
cadillac_ has quit [Ping timeout: 245 seconds]
<darix> z4phod: indirectly via discourse
cadillac_ has joined #ruby
guille-moe has quit [Remote host closed the connection]
jenrzzz has joined #ruby
guille-moe has joined #ruby
<z4phod> doesn't work for me without :allowall :'(
amar has joined #ruby
raul782 has joined #ruby
<darix> I think discourse limits it to admin only
amar has quit [Remote host closed the connection]
jenrzzz has quit [Ping timeout: 245 seconds]
heyimwill has joined #ruby
MXfive has joined #ruby
cagomez has joined #ruby
raynold has joined #ruby
byte00 has joined #ruby
jamiejackson has joined #ruby
jamiejackson has quit [Remote host closed the connection]
jamiejackson has joined #ruby
shadeslayer has quit [Ping timeout: 256 seconds]
guille-moe has quit [Remote host closed the connection]
amar has joined #ruby
shadeslayer has joined #ruby
guille-moe has joined #ruby
regedit has quit [Quit: Connection closed for inactivity]
Anastasiya has joined #ruby
<Anastasiya> I want to meet you
amar has quit [Ping timeout: 252 seconds]
Anastasiya has left #ruby [#ruby]
raul782 has quit []
parzydeuko has quit [Read error: Connection reset by peer]
drale2k_ has joined #ruby
apeiros has joined #ruby
[Butch] has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
chocoelho has joined #ruby
tdy has quit [Ping timeout: 264 seconds]
Mia has joined #ruby
Mia has joined #ruby
Mia has quit [Changing host]
yohji has quit [Remote host closed the connection]
jcarl43 has joined #ruby
dionysus69 has joined #ruby
Guest82488 has joined #ruby
claudiuinberlin has quit [Quit: Textual IRC Client: www.textualapp.com]
drale2k_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cadillac_ has quit [Ping timeout: 245 seconds]
Guest82488 has quit [Client Quit]
kmurphy4 has joined #ruby
cadillac_ has joined #ruby
chocoelho has quit [Ping timeout: 256 seconds]
mzo has joined #ruby
pastorin_ has quit [Read error: Connection reset by peer]
pastorinni has joined #ruby
npgm has quit [Quit: Connection closed for inactivity]
<cagomez> does `drop` mutate an array?
<apeiros> cagomez: is there a way you could figure this out?
<cagomez> apeiros: ah I see! the docs say ` -> new_ary` http://ruby-doc.org/core-2.4.2/Array.html#method-i-drop
<cagomez> I was only reading the description
<cagomez> does `-> ary` mean that it mutates the array?
<apeiros> I find the documentation unclear tbh, and was more referring to experimental ways.
<cagomez> could I compare `object_id`'s?
<apeiros> the return value being a new array says nothing about the state of the receiver
mtkd has quit [Ping timeout: 256 seconds]
<apeiros> that'll tell you that it's mutated if they're the same. but it doesn't help you if the object ids differ.
herbmillerjr has quit [Quit: Konversation terminated!]
<apeiros> >> a = [1,2,3]; a.drop(2); a
<ruby[bot]> apeiros: # => [1, 2, 3] (https://eval.in/1008843)
<apeiros> check the object you called the method on. if it remains unchanged, then it doesn't mutate.
mtkd has joined #ruby
<RougeR> would anyone be able to point nme in the right direction for this active record query: I have a user model and a gym model, with a has many through relation to a membership table
<apeiros> ?rails RougeR
<ruby[bot]> RougeR: Please join #RubyOnRails for Rails questions. You need to be identified with NickServ, see /msg NickServ HELP
<RougeR> i mean...its still AR
<apeiros> ?ar RougeR
<ruby[bot]> RougeR: For activerecord/arel questions, please join #RubyOnRails, since they're maintained as a part of it. Note: you need to be identified with NickServ, see /msg NickServ HELP
<RougeR> haha fair enough
<RougeR> ill ask there
<RougeR> ty
camilasan has quit [Ping timeout: 245 seconds]
sagax has quit [Ping timeout: 245 seconds]
anisha has quit [Quit: This computer has gone to sleep]
camilasan has joined #ruby
guille-moe has quit [Remote host closed the connection]
guille-moe has joined #ruby
tacoboy has joined #ruby
Bonjourm8 has quit [Remote host closed the connection]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Bonjourm8 has joined #ruby
Bonjourm8 has quit [Remote host closed the connection]
camilasan has quit [Ping timeout: 245 seconds]
amar has joined #ruby
bmurt has joined #ruby
bmurt has quit [Client Quit]
orbyt_ has joined #ruby
orbyt_ has quit [Client Quit]
bmurt has joined #ruby
drale2k_ has joined #ruby
amar has quit [Ping timeout: 252 seconds]
bmurt has quit [Remote host closed the connection]
bmurt has joined #ruby
sanscoeur has joined #ruby
orbyt_ has joined #ruby
nitric has joined #ruby
nayena has joined #ruby
guille-moe has quit [Ping timeout: 245 seconds]
camilasan has joined #ruby
byte00 has quit [Quit: Leaving]
pilne has joined #ruby
jarnalyrkar has joined #ruby
tdy has joined #ruby
shoogz has quit [Ping timeout: 260 seconds]
nfsnobody has quit [Ping timeout: 240 seconds]
tdy has quit [Client Quit]
nayena has quit [Ping timeout: 240 seconds]
shoogz has joined #ruby
nfsnobody has joined #ruby
thapakazi has quit [Quit: thapakazi]
dionysus69 has quit [Ping timeout: 245 seconds]
jrafanie has quit [Quit: Textual IRC Client: www.textualapp.com]
mzo has quit [Ping timeout: 245 seconds]
pastorinni has quit [Read error: No route to host]
pastorinni has joined #ruby
eckhardt has joined #ruby
hahuang65 has joined #ruby
camilasan has quit [Read error: Connection reset by peer]
phaul has joined #ruby
amar has joined #ruby
camilasan has joined #ruby
chouhoul_ has joined #ruby
chouhoul_ has quit [Read error: Connection reset by peer]
chouhoul_ has joined #ruby
hahuang65 has quit [Quit: ZNC 1.7.0 - https://znc.in]
chouhoulis has quit [Ping timeout: 264 seconds]
alfiemax has joined #ruby
amar has quit [Ping timeout: 252 seconds]
drale2k_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rivalomega has quit [Remote host closed the connection]
rivalomega has joined #ruby
emilford has quit [Ping timeout: 256 seconds]
hahuang65 has joined #ruby
emilford has joined #ruby
quobo has joined #ruby
emilford has quit [Ping timeout: 256 seconds]
pastorinni has quit [Read error: Connection reset by peer]
pastorinni has joined #ruby
clemens3 has quit [Ping timeout: 256 seconds]
rivalomega has quit [Remote host closed the connection]
rivalomega has joined #ruby
venmx has quit [Ping timeout: 248 seconds]
emilford has joined #ruby
kmurphy4 has quit [Quit: kmurphy4]
dionysus69 has joined #ruby
grilix has quit [Ping timeout: 245 seconds]
phaul has quit [Ping timeout: 260 seconds]
drale2k_ has joined #ruby
phaul has joined #ruby
orbyt_ has quit [Quit: Textual IRC Client: www.textualapp.com]
emilford has quit [Ping timeout: 240 seconds]
emilford has joined #ruby
ramfjord has joined #ruby
dionysus69 has quit [Read error: Connection reset by peer]
dionysus69 has joined #ruby
grilix has joined #ruby
roshanavand has quit [Ping timeout: 260 seconds]
amar has joined #ruby
grilix_ has joined #ruby
emilford has quit [Ping timeout: 245 seconds]
emilford has joined #ruby
nitric_ has joined #ruby
grilix has quit [Ping timeout: 248 seconds]
nitric has quit [Ping timeout: 245 seconds]
ramfjord has quit [Ping timeout: 252 seconds]
emilford has quit [Ping timeout: 245 seconds]
emilford has joined #ruby
hinbody has joined #ruby
hinbody has left #ruby [#ruby]
joast has quit [Remote host closed the connection]
braincrash has joined #ruby
chouhoul_ has quit [Remote host closed the connection]
chouhoulis has joined #ruby
nfsnobody has quit [Ping timeout: 245 seconds]
nfsnobody has joined #ruby
suukim has quit [Quit: Konversation terminated!]
biberu has joined #ruby
nfsnobody has quit [Ping timeout: 240 seconds]
ramfjord has joined #ruby
nfsnobody has joined #ruby
drale2k_ has quit [Ping timeout: 252 seconds]
sauvin has quit [Read error: Connection reset by peer]
alfiemax has quit [Remote host closed the connection]
kirun has joined #ruby
alfiemax has joined #ruby
alfiemax has quit [Ping timeout: 252 seconds]
orbyt_ has joined #ruby
sytherax has joined #ruby
howdoi has joined #ruby
gnufied has quit [Ping timeout: 245 seconds]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
chocoelho has joined #ruby
alfiemax has joined #ruby
ryzokuke_ has joined #ruby
noobineer has joined #ruby
gnufied has joined #ruby
bmurt has joined #ruby
alfiemax has quit [Remote host closed the connection]
pastorinni has quit [Remote host closed the connection]
alfiemax has joined #ruby
t0xik has joined #ruby
pastorinni has joined #ruby
bmurt has quit [Client Quit]
alfiemax_ has joined #ruby
jsaak has quit [Ping timeout: 264 seconds]
alfiemax has quit [Ping timeout: 256 seconds]
GotAQuestion has joined #ruby
jsaak has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jenrzzz has quit [Ping timeout: 260 seconds]
sytherax has quit [Read error: Connection reset by peer]
GotAQuestion has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
Mike11 has quit [Quit: Leaving.]
Rapture has quit [Quit: Textual IRC Client: www.textualapp.com]
kapil___ has quit [Quit: Connection closed for inactivity]
amatas has quit [Quit: amatas]
jenrzzz has joined #ruby
pastorinni has quit [Remote host closed the connection]
pastorinni has joined #ruby
NightMonkey has quit [Quit: ZNC - http://znc.in]
pastorinni has quit [Ping timeout: 240 seconds]
NightMonkey has joined #ruby
alfiemax_ has quit [Remote host closed the connection]
conta has quit [Ping timeout: 260 seconds]
MXfive has quit [Quit: Sleep Quit.]
mlkkk has quit [Remote host closed the connection]
anjen has joined #ruby
anjen has quit [Client Quit]
jenrzzz has quit [Ping timeout: 245 seconds]
kmurphy4 has joined #ruby
xt233 has joined #ruby
phaul has quit [Ping timeout: 264 seconds]
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
MXfive has joined #ruby
jnollette has quit [Remote host closed the connection]
ipeee has joined #ruby
biberu has quit []
Cavallari has joined #ruby
tvw has joined #ruby
duderonomy has quit [Ping timeout: 260 seconds]
duderonomy has joined #ruby
ipee has quit [Ping timeout: 252 seconds]
joro_ has quit [Ping timeout: 260 seconds]
cagomez has quit [Remote host closed the connection]
cagomez has joined #ruby
xt233 has left #ruby ["Leaving"]
clemens3 has joined #ruby
ryzokuke_ is now known as ryzokuken[zzz]
ryzokuken[zzz] is now known as ryzokuke_
cagomez has quit [Ping timeout: 245 seconds]
RougeR has quit [Ping timeout: 252 seconds]
ta_ has quit [Remote host closed the connection]
joast has joined #ruby
jenrzzz has quit [Quit: Lost terminal]
SeepingN has joined #ruby
drona6 has joined #ruby
drona6 has quit [Client Quit]
sanscoeu_ has joined #ruby
sytherax has joined #ruby
contradictioned has quit [Ping timeout: 256 seconds]
sanscoeur has quit [Ping timeout: 252 seconds]
noobineer has quit [Ping timeout: 264 seconds]
alfiemax has joined #ruby
bauruine has quit [Ping timeout: 256 seconds]
sonne has quit [Ping timeout: 256 seconds]
elomatreb has quit [Ping timeout: 256 seconds]
elomatreb has joined #ruby
contradictioned has joined #ruby
sonne has joined #ruby
alfiemax has quit [Ping timeout: 260 seconds]
<quuxman> can I define a method with some required positional params followed by optional params with default values like Python? Or do I need to pass a hash and do this manually?
bauruine has joined #ruby
jenrzzz has joined #ruby
joast has quit [Quit: Leaving.]
contradictioned has quit [Ping timeout: 245 seconds]
roshanavand has joined #ruby
<elomatreb> quuxman: You can use keyword arguments with defaults, and mix them with position arguments
joast has joined #ruby
<quuxman> but it looks like you have to specify all of them in the original order when calling them? Or maybe my syntax is wrong. One of my arguments with a default is turning into a Hash
k0mpa has joined #ruby
<elomatreb> You shouldn't need to watch order in either case
<elomatreb> (The thing with the hash is a bit of a holdover from before we had real keyword arguments)
<quuxman> my first keyword argument ends up holding a Hash of all the following keyword arguments. How can I fix that?
orbyt_ has joined #ruby
contradictioned has joined #ruby
<quuxman> and it's weird that it only happesn to one. The rest are as passed
<elomatreb> Could you share your method signature, and how you're calling it? This seeems strange
sagax has joined #ruby
<quuxman> def bulk_query(collection, for_record, window=50000, delay=0, skip=0, max_to_min=true, limit=false) ...
<quuxman> bulk_query Foo, method(:log_foo), window:2, delay:1, limit:20
sanscoeu_ has quit [Remote host closed the connection]
<elomatreb> Oh, yeah. The syntax for keyword arguments is def(keywordName: optional_value)
<quuxman> ah :P
sanscoeur has joined #ruby
<quuxman> how did what I had parse?
jnollette has joined #ruby
<elomatreb> You can have arbitrary expressions in argument lists (e.g. calls to other methods), I guess
contradictioned has quit [Ping timeout: 245 seconds]
pastorinni has joined #ruby
plexigras has quit [Ping timeout: 260 seconds]
<quuxman> looks like my calling syntax was also wrong
tacoboy has quit [Remote host closed the connection]
<ccooke> Your def is syntactically valid - it defines a method with only positional arguments, several of which have defaults
contradictioned has joined #ruby
<elomatreb> Oh, right, yeah. That also explains the "all keywords end up in the same hash" thing
<elomatreb> If a hash literal is the last argument in a method call, you are allowed to leave off the curly braces
<ccooke> When you call it, window:2 indicates that it (and the rest of the following arguments) are keyword arguments. Since you have no keyword arguments defined, you get the old-style "Just shove them in a hash" method, which gets assigned to "window" because it happens to be the next positional argument
mtkd has quit [Ping timeout: 264 seconds]
<quuxman> ok I get that. BTW is there a way to reload a require, or do I have to restart pry?
<elomatreb> Kernel#load does that, require explicitly does not
sytherax has quit [Remote host closed the connection]
mtkd has joined #ruby
cagomez has joined #ruby
contradictioned has quit [Ping timeout: 256 seconds]
sytherax has joined #ruby
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
nowhere_man has joined #ruby
tdy has joined #ruby
contradictioned has joined #ruby
ryzokuke_ has quit [Quit: Textual IRC Client: www.textualapp.com]
pastorinni has quit [Remote host closed the connection]
Asher has quit [Ping timeout: 260 seconds]
Dbugger has quit [Remote host closed the connection]
contradictioned has quit [Ping timeout: 256 seconds]
contradictioned has joined #ruby
Mike11 has joined #ruby
pastorinni has joined #ruby
RougeR has joined #ruby
RougeR has joined #ruby
RougeR has quit [Changing host]
MXfive has quit [Quit: Sleep Quit.]
TinkerT has quit [Read error: Connection reset by peer]
jenrzzz has quit [Ping timeout: 248 seconds]
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
TinkerT has joined #ruby
Asher has joined #ruby
nowhere_man has quit [Remote host closed the connection]
nowhere_man has joined #ruby
jenrzzz has quit [Ping timeout: 260 seconds]
Cavallari has quit [Quit: Cavallari]
SeepingN_ has joined #ruby
SeepingN has quit [Disconnected by services]
jenrzzz has joined #ruby
Burgestrand has quit [Quit: Closing time!]
dionysus69 has quit [Ping timeout: 264 seconds]
jenrzzz has quit [Ping timeout: 260 seconds]
noobineer has joined #ruby
ur5us has joined #ruby
jenrzzz has joined #ruby
dviola has quit [Ping timeout: 260 seconds]
venmx has joined #ruby
grilix_ has quit [Ping timeout: 245 seconds]
ldnunes has quit [Quit: Leaving]
jenrzzz has quit [Ping timeout: 252 seconds]
jamiejackson has quit [Remote host closed the connection]
rivalomega has quit [Remote host closed the connection]
mtkd has quit []
jenrzzz has joined #ruby
rivalomega has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
venmx has quit [Remote host closed the connection]
garyserj has joined #ruby
<garyserj> does ruby have a distinction between a)class variables b)class instance variables c)instance variables ?
pastorinni has quit []
schleppel has quit [Remote host closed the connection]
kirun has quit [Quit: Konversation terminated!]
alfiemax has joined #ruby
<havenwood> garyserj: b and c are the same thing
<havenwood> garyserj: instance variable is short for class instance variable
<havenwood> garyserj: avoid class variables
jarnalyrkar has quit [Quit: Leaving]
alfiemax has quit [Ping timeout: 256 seconds]
vision_ has joined #ruby
amelliaa has quit [Quit: -]
ta_ has joined #ruby
minimalism has quit [Quit: minimalism]
jinie has quit [Quit: ZNC 1.6.1 - http://znc.in]
<garyserj> I heard that if an instance variable is in a class method, then it is a class instance variable
jinie has joined #ruby
mlkkk has joined #ruby
sytherax has quit [Remote host closed the connection]
<havenwood> garyserj: Maybe some people mean that, but it's confusing. I'd say a class-level instance variable.
<havenwood> garyserj: Here's a discussion of class variables versus class-level instance variables: https://bugs.ruby-lang.org/issues/14541
<garyserj> if an instance variable is not class-level, is it local?
ta_ has quit [Remote host closed the connection]
<havenwood> garyserj: no, instance
ta_ has joined #ruby
k0mpa has quit [Quit: k0mpa]
<havenwood> garyserj: local variables are local to the method where they're defined. instance variables are shared between methods on the same class instance.
<garyserj> okay so when an instance level is not at class level, what is its level?
<havenwood> garyserj: regular, the instance of the class
<garyserj> I mean.. okay so when an instance variable is not at class level, what is its level?
<garyserj> when you say class-level instance variable, isn't that superfluous if you mean that all instance variables are class-level?
<havenwood> garyserj: a class-level instance variable is a bit of an odd thing, but class variables have broken semantics, so we do what we do
<garyserj> okay so are you suggesting that some instance variables are class level and some aren't?
<havenwood> garyserj: an instance variable is supposed to be shared between methods on the same instance of the class.
<garyserj> so are some class level and some not? or are they all class level?
Shadow25 has joined #ruby
reber has quit [Remote host closed the connection]
Shadow25 has quit [Client Quit]
<havenwood> garyserj: most are specific to an instance of a class, that's why they're called "instance" variables. some aren't used for instances at all, they're used oddly at the class-level. those are the class-level instance variables.
<havenwood> garyserj: the link above discusses why we do such things and proposes some solutions
<havenwood> garyserj: It's like if you had a food-level hat. oddly, you're wearing a hat on your foot.
chouhoul_ has joined #ruby
<havenwood> garyserj: It is in fact a hat. On your foot. Normal hats are head hats. We just say "hat," meaning a head hat. If you want to mean the odd foot hats, say foot-level hat. ;-P
<havenwood> Shoes, it turned out, have broken semantics. So we wear hats on our feet. Voila!
<havenwood> "...[T]he use of class variables is not recommended (like global variables)..." ~Matz
<garyserj> why do you keep mentioning class variables though?
chouhoulis has quit [Ping timeout: 245 seconds]
<garyserj> when i'm asking about instance variables, and class-level instance variables
rivalomega has quit [Remote host closed the connection]
<garyserj> are you including "class-level instance variables" as your class variables?
chouhoul_ has quit [Ping timeout: 252 seconds]
<havenwood> garyserj: Yeah, class-level instance variables are used as a stand-in for class variables. I'm just mentioning class variables to explain why we're in this situation.
anjen has joined #ruby
<garyserj> are all instance variables shared among instance methods?
rivalomega has joined #ruby
<havenwood> garyserj: yes
<garyserj> so what causes an instance variable to be 'class level'? is it use of it outside of any methods?
<havenwood> instance-wide
<havenwood> garyserj: Yes, using them at class-level, outside a method.
<havenwood> Or in a class method
<havenwood> garyserj: The klass itself is an instance of Class.
<havenwood> >> class X; end; X.instance_of? Class
<ruby[bot]> havenwood: # => true (https://eval.in/1008896)
<havenwood> garyserj: ^
<garyserj> thanks
<havenwood> >> class Foo; @foo = :foo end; Foo.instance_variable_get :@foo
<ruby[bot]> havenwood: # => :foo (https://eval.in/1008900)
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<havenwood> garyserj: You're welcome
<garyserj> suppose an instance variable is sometimes used in instance methods and sometimes outside of them. Does the fact that it's sometimes used outside of them mean that it is always referred to as a class-level instance variable. Or is it only referred to as a class-level instance variable in the places where it is used outside of instance methods?
[Butch] has quit [Quit: Textual IRC Client: www.textualapp.com]
sytherax has joined #ruby
<havenwood> garyserj: Foo is itself an instance of Class. Instance variables on this Foo instance of Class are called class-level instance variables.
<havenwood> garyserj: These variables are shared by all class methods of the Foo class instance of Class.
<havenwood> garyserj: Foo also has instances. Those instances of Foo share instance variables between instance methods.
vision_ has left #ruby [#ruby]
<havenwood> garyserj: There's one Foo instance of Class where class-level instance variables live.
<havenwood> garyserj: There are many instances of Foo, which each have regular instance variables.
<havenwood> garyserj: Each instance of foo has different instance variables.
<havenwood> garyserj: The single Foo instance of Class has it's "class-level" instance variables.
<havenwood> its*
<havenwood> garyserj: Does that make sense?
<havenwood> garyserj: If you define an instance variable on a thing that is itself an instance of Class, we call it a class-level instance variable.
<havenwood> garyserj: Foo.new.instance_of? Class #=> false
<havenwood> garyserj: Foo.new.instance_of? Foo #=> true
<havenwood> garyserj: Foo.instance_of? Class #=> true
<havenwood> garyserj: Foo is an instance of Class. There's just one Foo. #<Foo:...> is an instance of Foo.
<havenwood> garyserj: There can be many #<Foo:...>.
<havenwood> garyserj: My advice would be don't define your own global or class variables. If you need a class-level instance variable think long an hard about why, and solicit advice on alternatives or correct implementation.
<havenwood> garyserj: Use local and instance variables liberally.
<havenwood> garyserj: Use local if it's intra-method. Use instance if it's intra-instance.
emilford has quit [Ping timeout: 245 seconds]
<havenwood> garyserj: A module_function module in Ruby has no state when used properly. It's just a drawer of functions. If you call that function with the same arguments, it'll return the same results. Nothing on the module can change that will affect the function return value.
Eiam has quit [Ping timeout: 240 seconds]
<garyserj> ah sorry was afk just reading now
<havenwood> garyserj: A Singleton Class has just one instance of state. If that state change, the instance methods on that single instance can change return values. This is where instance variables come into play. This one instance has maybe many instance variables. If it didn't have any instance variables, it could and should just be a module.
shinnya has joined #ruby
<havenwood> garyserj: A Class can have many instances of state. Each instance has maybe many instance variables. Those variables can be different for each instance of the class. Since that state can be different between instances, the same method on different instances can return different values.
<havenwood> I'll stop typing until you catch up with the wall of text. ;-P
zlogan2003 has joined #ruby
<garyserj> heh, thanks
emilford has joined #ruby
orbyt_ has quit [Quit: Textual IRC Client: www.textualapp.com]
zlogan2003 has quit [Client Quit]
zlogan2003 has joined #ruby
<garyserj> I know java so I know the difference between static and instance.
zlogan2003 has quit [Client Quit]
zlogan2003 has joined #ruby
zlogan2003 has quit [Client Quit]
<garyserj> You wrote "If you define an instance variable on a thing that is itself an instance of Class," But what defines a variable though.. it seems in ruby you just write a statement like @a=4 and hey presto that defined it, but you may have @a=4 elsewhere. So which one defined it? the one that ran first I suppose?
zlogan2003 has joined #ruby
emilford has quit [Ping timeout: 245 seconds]
<garyserj> so if an @ variable is defined outside of methods and within instance methods, then is it class-level or not?
Liothen has quit [Changing host]
Liothen has joined #ruby
jenrzzz has quit [Ping timeout: 256 seconds]
<eam> garyserj: it's always an instance variable of the class you're in
<eam> and you are always in a class
<eam> and yes, the first time a variable is assigned it's instantiated and subsequent assignments reassign it
<garyserj> okay so do you think that there aren't two types of instance variables?
<eam> I haven't read all the scrollback - what do you mean by two types?
<garyserj> class-level instance variables, and instance variables that aren't class-level.
<eam> you mean like @@foo vs @foo?
<eam> what does "class level" mean here?
<eam> available to all instances of the class?
<garyserj> no I mean only @/
emilford has joined #ruby
<garyserj> I mean @ not @@.
<garyserj> @@ is not an instance variable of any kind.
<eam> what does "class level" mean here?
<garyserj> I don't really understand myself.
<garyserj> I understand what you're saying though.
<garyserj> but some people speak of some instance variables being class-level, so it's more a question for them.
<eam> oh, I just scrolled up and saw what havenwood was saying
<garyserj> that speaks of class instance variables.
<eam> I think he's saying that a class (like Foo) is itself an instance of Class
<eam> and can contain instance variables
mikeeeeeeey has joined #ruby
<eam> a class is an instance
<eam> a class is a type of object. it is also an instance of an object (of type Class)
<garyserj> "A disadvantage of class instance variables is that they cannot be used within instance methods as class variables can. Another disadvantage is the potential for confusing them with ordinary instance variables. "
<eam> yeah
<garyserj> so that toptalkedbooks link has a clear distinctio between two types of instance variable
<mikeeeeeeey> hi, can someone check this https://gist.github.com/mikesavtechnology/5330bb0f0129d5b29a9b482311036b8c ? thank you
<garyserj> If a class has instance variables, that wouldn't mean we have two types of instance variables though?
<garyserj> that toptalkedbooks link is showing an instance variable within a method to be not class-level, whereas an instance variable outside of a method to be class-level
<eam> garyserj: what if it means you have one type, but two scopes?
mlkkk has quit [Remote host closed the connection]
<eam> the scope inside and outside of an instance method differs
<eam> what is "self" in each scope?
<garyserj> An instance method used in one method, isn't it completely accessible from another instance method, so same scope?
<eam> what I mean is that self changes
<garyserj> so are you suggesting there's a scope shared by instance methods, and a scope outside of instance methods, and they're different?
emilford has quit [Ping timeout: 248 seconds]
<eam> yes
<eam> in an instance method, self is the instance
<eam> outside, it's the class (the instance of the Foo class)
<garyserj> interesting, thanks
<eam> @ defines an instance variable against self
shortdudey123_ has joined #ruby
<garyserj> wow
<garyserj> what a crazy language
<garyserj> java is so much simpler
shortdudey123 has quit [Ping timeout: 276 seconds]
shortdudey123_ is now known as shortdudey123
<garyserj> in terms of static(non-instance) variables and instance variables. and strictness about where they are defined and their scope.
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
sanscoeu_ has joined #ruby
emilford has joined #ruby
sanscoeur has quit [Ping timeout: 260 seconds]
sanscoeu_ has quit [Ping timeout: 240 seconds]
emilford has quit [Ping timeout: 240 seconds]
jenrzzz has quit [Ping timeout: 264 seconds]
jenrzzz has joined #ruby
emilford has joined #ruby
<havenwood> Ruby, you'll shoot your eye out!
t0xik has quit [Quit: Connection closed for inactivity]
<havenwood> mikeeeeeeey: Check it for what?
SeepingN_ has quit [Ping timeout: 240 seconds]
SeepingN has joined #ruby
<havenwood> mikeeeeeeey: I don't like how your redefine the `license_output` variable from a String to the result of parsing the JSON: https://gist.github.com/mikesavtechnology/5330bb0f0129d5b29a9b482311036b8c#file-gistfile1-txt-L8
<havenwood> mikeeeeeeey: Why are your Hash Symbol keys capitalized?
<mikeeeeeeey> still learning
<mikeeeeeeey> my first script
<havenwood> mikeeeeeeey: On line 8, consider a new variable name. Maybe just: license = JSON.parse(license_output)
<havenwood> mikeeeeeeey: You can switch `:Connected => user_output["n_clients"]` to `Connected: user_output["n_clients"]`
venmx has joined #ruby
alfiemax has joined #ruby
alfiemax has quit [Ping timeout: 245 seconds]
dviola has joined #ruby
amar has quit [Remote host closed the connection]
<havenwood> mikeeeeeeey: I commented on your gist with an alternative way of organizing the code to give you something to ponder.
<havenwood> (I guess not a pure refactor because I made the symbols lowercase.)
dviola has quit [Changing host]
dviola has joined #ruby
<mikeeeeeeey> thank you
emilford has quit [Ping timeout: 260 seconds]
emilford has joined #ruby
ur5us has quit [Read error: Connection reset by peer]
ur5us has joined #ruby
emilford has quit [Ping timeout: 256 seconds]
kapil___ has joined #ruby
t0xik has joined #ruby
emilford has joined #ruby
lxsameer has quit [Ping timeout: 256 seconds]
emilford has quit [Ping timeout: 252 seconds]
emilford has joined #ruby
venmx has quit [Ping timeout: 260 seconds]
anjen has quit [Quit: anjen]