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]
<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]
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]
<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]
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
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]
<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.
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?
<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
<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
<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]