brent__ has quit [Remote host closed the connection]
Channel6 has quit [Quit: Leaving]
Suslov has joined #ruby
amclain_ has joined #ruby
KicStart has left #ruby [#ruby]
Derperperd has quit [Ping timeout: 240 seconds]
Azure has quit [Read error: Connection reset by peer]
AndrewIsHere has quit []
Azure has joined #ruby
d^sh has quit [Ping timeout: 240 seconds]
sid_fules has joined #ruby
amclain has quit [Ping timeout: 240 seconds]
d^sh has joined #ruby
polyidus has joined #ruby
rhyselsmore has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
StevenStulu has joined #ruby
ThereIsNoYeti has quit [Ping timeout: 246 seconds]
sid_fules has quit [Ping timeout: 264 seconds]
montanonic has quit [Ping timeout: 240 seconds]
bmurt has joined #ruby
benlieb has joined #ruby
hutch34 has quit [Ping timeout: 240 seconds]
duderono_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gsilva has joined #ruby
polyidus has quit [Quit: ZZZzzz…]
brent__ has joined #ruby
jdm has joined #ruby
gsilva has quit [Ping timeout: 240 seconds]
dstrunk has joined #ruby
jhack has quit [Quit: Leaving]
Pisuke has quit [Ping timeout: 240 seconds]
pabloh has joined #ruby
SteenJobs has joined #ruby
pabloh has quit [Client Quit]
itsautomatisch has joined #ruby
im314ous has quit [Ping timeout: 260 seconds]
marcdel has joined #ruby
gloscombe has quit [Quit: gloscombe]
manjaro-kde5-- has joined #ruby
polyidus has joined #ruby
nowhere_man has joined #ruby
LBRapid has quit [Remote host closed the connection]
brent__ has quit [Remote host closed the connection]
libastral has quit [Ping timeout: 240 seconds]
Tempesta has quit [Ping timeout: 246 seconds]
libastral has joined #ruby
nOwz has joined #ruby
hutch34 has joined #ruby
Channel6 has joined #ruby
montanonic has joined #ruby
nOwz has quit [Ping timeout: 240 seconds]
LBRapid has joined #ruby
hutch34 has quit [Ping timeout: 240 seconds]
SteenJobs has quit [Quit: SteenJobs]
Suslov has quit [Remote host closed the connection]
Suslov has joined #ruby
marcdel has quit [Ping timeout: 260 seconds]
Tempesta has joined #ruby
sid_fules has joined #ruby
manjaro-kde5-- has quit [Ping timeout: 240 seconds]
montanonic has quit [Ping timeout: 264 seconds]
nowhere_man has quit [Remote host closed the connection]
sid_fules has quit [Ping timeout: 264 seconds]
nowhere_man has joined #ruby
duderonomy has joined #ruby
astrobunny has joined #ruby
marcdel has joined #ruby
pawnbox has joined #ruby
Channel6 has quit [Quit: Leaving]
djbkd has quit [Remote host closed the connection]
pawnbox has quit [Ping timeout: 260 seconds]
pwnd_nsfw` has quit [Read error: Connection reset by peer]
bmurt has quit [Read error: Connection reset by peer]
pwnd_nsfw` has joined #ruby
brendan- has quit [Read error: Connection reset by peer]
jgnagy has quit [Read error: Connection reset by peer]
jgnagy has joined #ruby
bmurt has joined #ruby
Suslov has quit [Remote host closed the connection]
Suslov has joined #ruby
dstrunk has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
brendan- has joined #ruby
maloik56 has joined #ruby
enterprisey has joined #ruby
Suslo has joined #ruby
maloik has quit [Remote host closed the connection]
Suslov has quit [Remote host closed the connection]
howdoi has joined #ruby
jeyraof^mbpr has joined #ruby
cdg_ has quit [Remote host closed the connection]
cdg has joined #ruby
polyidus has quit [Quit: ZZZzzz…]
bkxd has joined #ruby
sid_fules has joined #ruby
millerti has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
mula has quit [Remote host closed the connection]
ResidentBiscuit has joined #ruby
sid_fules has quit [Ping timeout: 264 seconds]
Akuya has quit [Quit: Leaving]
Derperperd has joined #ruby
djbkd has joined #ruby
pawnbox has joined #ruby
djbkd has quit [Ping timeout: 240 seconds]
marchelzo is now known as bg
skang has joined #ruby
pawnbox has quit [Ping timeout: 264 seconds]
cdg_ has joined #ruby
itsautomatisch has quit [Ping timeout: 240 seconds]
pulkit4tech has joined #ruby
cdg has quit [Ping timeout: 256 seconds]
raspado has quit [Remote host closed the connection]
<skang>
hi
<havenwood>
skang: hi
raspado has joined #ruby
<bg>
hi skang
govg has quit [Ping timeout: 260 seconds]
astrobunny has quit [Remote host closed the connection]
blackwind_123 has joined #ruby
skweek has joined #ruby
cfec0b8d has quit [Ping timeout: 260 seconds]
hutch34 has joined #ruby
herbmillerjr has quit [Remote host closed the connection]
jenrzzz has joined #ruby
raspado has quit [Ping timeout: 260 seconds]
herbmillerjr has joined #ruby
rhyselsmore has joined #ruby
hutch34 has quit [Ping timeout: 268 seconds]
JoshS has quit [Ping timeout: 268 seconds]
gnufied has quit [Ping timeout: 246 seconds]
djbkd has joined #ruby
sid_fules has joined #ruby
__Yiota has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
sid_fules has quit [Ping timeout: 264 seconds]
electrostat has quit [Quit: uwotm8]
electrostat has joined #ruby
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jdm has quit [Remote host closed the connection]
jameser_ has joined #ruby
ResidentBiscuit has quit [Remote host closed the connection]
ResidentBiscuit has joined #ruby
jameser has quit [Ping timeout: 260 seconds]
Suslov has joined #ruby
griffindy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gix has quit [Ping timeout: 260 seconds]
ResidentBiscuit has quit [Ping timeout: 246 seconds]
VladGh has quit [Remote host closed the connection]
Suslo has quit [Ping timeout: 258 seconds]
cdg_ has quit [Ping timeout: 240 seconds]
Suslov has quit [Ping timeout: 260 seconds]
VladGh has joined #ruby
[reed] has quit [Ping timeout: 260 seconds]
gix has joined #ruby
[reed] has joined #ruby
[reed] has joined #ruby
[reed] has quit [Changing host]
pawnbox has joined #ruby
enterprisey has quit [Remote host closed the connection]
igniting has quit [Ping timeout: 240 seconds]
JoshS has joined #ruby
sid_fules has joined #ruby
pilne has quit [Quit: Quitting!]
govg has joined #ruby
sid_fules has quit [Ping timeout: 264 seconds]
skang_ has joined #ruby
__Yiota has joined #ruby
skang has quit [Ping timeout: 240 seconds]
enterprisey has joined #ruby
blackwind_123 has quit [Ping timeout: 260 seconds]
pwnd_nsfw has joined #ruby
skang_ has quit [Remote host closed the connection]
pwnd_nsfw` has quit [Ping timeout: 268 seconds]
skweek has quit [Ping timeout: 258 seconds]
montanonic has joined #ruby
mula has joined #ruby
boog has joined #ruby
Pisuke has joined #ruby
nOwz has joined #ruby
hutch34 has joined #ruby
astrobunny has joined #ruby
weaksauce has joined #ruby
aryaching has quit [Ping timeout: 240 seconds]
nOwz has quit [Ping timeout: 256 seconds]
tvw has joined #ruby
mula has quit [Remote host closed the connection]
aryaching has joined #ruby
DTZOZU has joined #ruby
hutch34 has quit [Ping timeout: 256 seconds]
pawnbox_ has joined #ruby
hotpancakes has joined #ruby
pawnbox has quit [Read error: Connection reset by peer]
morfin has joined #ruby
aryaching has quit [Read error: Connection reset by peer]
DTZOZU has quit [Client Quit]
ThereIsNoYeti has joined #ruby
sid_fules has joined #ruby
djbkd has quit [Remote host closed the connection]
djbkd has joined #ruby
igniting has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
sid_fules has quit [Ping timeout: 264 seconds]
Rodya_ has quit [Quit: Leaving...]
<morfin>
how instance_eval is implemented?
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
<matthewd>
morfin: What do you mean?
CloCkWeRX has quit [Quit: Leaving.]
skang has joined #ruby
ThereIsNoYeti has quit [Ping timeout: 260 seconds]
boog has quit [Remote host closed the connection]
<morfin>
i mean does it create method on that object?
<matthewd>
No
enterprisey has quit [Remote host closed the connection]
<morfin>
I know it set self but not sure how
skang has quit [Ping timeout: 260 seconds]
tdy has quit [Ping timeout: 268 seconds]
marcdel has quit [Ping timeout: 260 seconds]
aupadhye has joined #ruby
<matthewd>
It exists inside the interpreter; how it does it is no more interesting than how self gets set when you call a method on one object from another
ThereIsNoYeti has joined #ruby
noobcake has quit [Ping timeout: 246 seconds]
benlieb has quit [Quit: benlieb]
rkazak_ has joined #ruby
<morfin>
well as i know JS MyClass.mymethod.bind(instanceofmyclass) create special "native" wrapper
renchan has joined #ruby
auzty has joined #ruby
<matthewd>
How does (JS) mymethod.call(myinstance) work?
aupadhye has quit [Ping timeout: 240 seconds]
<morfin>
hm it do same thing as bind + call that thing?
elifoster has joined #ruby
hotpanca_ has joined #ruby
anisha has joined #ruby
hotpancakes has quit [Ping timeout: 246 seconds]
sid_fules has joined #ruby
lenwood has joined #ruby
govg has quit [Ping timeout: 240 seconds]
sid_fules has quit [Ping timeout: 264 seconds]
lenwood has quit [Ping timeout: 260 seconds]
<morfin>
apply do similar thing
mwlang has quit [Quit: mwlang]
<matthewd>
Right. And instance_eval in ruby works the same way. Just like those JS ones, it's a built-in native thing.
boog has joined #ruby
boog has quit [Remote host closed the connection]
boog has joined #ruby
aupadhye has joined #ruby
noobcake has joined #ruby
hotpanca_ has quit [Remote host closed the connection]
hahuang65 has quit [Quit: WeeChat 1.7]
saneax-_-|AFK is now known as saneax
<morfin>
but instance_eval also allows execution of block in context of an object
pawnbox_ has quit [Remote host closed the connection]
<dminuoso>
06:50 < matthewd> [05:42:56] How does (JS) mymethod.call(myinstance) work?
<dminuoso>
just like that
pawnbox has joined #ruby
squ has joined #ruby
Cohedrin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
jenrzzz has quit [Ping timeout: 268 seconds]
pawnbox has quit [Ping timeout: 268 seconds]
Immune has joined #ruby
hutch34 has joined #ruby
barnett has joined #ruby
hutch34 has quit [Ping timeout: 260 seconds]
pawnbox has joined #ruby
jenrzzz has joined #ruby
Guest65382 has joined #ruby
tau has quit [Remote host closed the connection]
tildes has joined #ruby
StevenStulu has quit [Read error: Connection reset by peer]
Cohedrin has joined #ruby
rkazak_ has quit [Quit: Sleep.....ing....]
boog has quit []
Guest65382 has left #ruby ["Once you know what it is you want to be true, instinct is a very useful device for enabling you to know that it is"]
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Silthias1 has joined #ruby
ghoti has quit [Ping timeout: 268 seconds]
ghoti has joined #ruby
Silthias has quit [Ping timeout: 256 seconds]
tystr has quit [Ping timeout: 245 seconds]
havenwood has quit [Ping timeout: 240 seconds]
aaronm04 has quit [Ping timeout: 252 seconds]
bocaneri has joined #ruby
bocaneri has quit [Max SendQ exceeded]
dikaio has quit [Ping timeout: 245 seconds]
tystr has joined #ruby
pragmatism has quit [Ping timeout: 255 seconds]
dikaio has joined #ruby
hahuang65 has joined #ruby
havenwood has joined #ruby
havenwood has joined #ruby
pragmatism has joined #ruby
xall has joined #ruby
aaronm04 has joined #ruby
rhyselsmore has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
bocaneri has joined #ruby
govg has joined #ruby
bg has quit [Quit: :*]
barnett has quit []
CloCkWeRX has joined #ruby
ThereIsNoYeti has quit [Ping timeout: 260 seconds]
montanonic has quit [Ping timeout: 264 seconds]
ThereIsNoYeti has joined #ruby
last_staff has joined #ruby
tildes has quit [Ping timeout: 260 seconds]
7F1AAF8S6 has quit [Ping timeout: 245 seconds]
brainslug has quit [Ping timeout: 260 seconds]
hotpancakes has joined #ruby
Suslov has joined #ruby
jenrzzz has quit [Ping timeout: 260 seconds]
gusrub has quit [Remote host closed the connection]
Suslov has quit [Ping timeout: 240 seconds]
mikeiniowa has quit [Ping timeout: 240 seconds]
pawnbox has quit [Read error: Connection reset by peer]
nOwz has joined #ruby
deweysdecimal has joined #ruby
byte512 has joined #ruby
pawnbox has joined #ruby
naftilos76 has joined #ruby
naftilos76 has quit [Read error: Connection reset by peer]
jgnagy has quit [Remote host closed the connection]
manjaro-kde5-- has quit [Quit: Konversation terminated!]
rhyselsmore has joined #ruby
Arpanet69 has quit [Ping timeout: 260 seconds]
andikr has joined #ruby
solocshaw has quit [Ping timeout: 246 seconds]
<morfin>
i see usage depends on context - somewhere it's self, somewhere that function pointer
aganov has joined #ruby
okdas has joined #ruby
okdas has joined #ruby
okdas has quit [Changing host]
nocco has joined #ruby
xall has quit [Ping timeout: 246 seconds]
zenguy_pc2 has quit [Ping timeout: 256 seconds]
<morfin>
dminuoso, C++ is bottomless pit
okdas has quit [Client Quit]
zenguy_pc has joined #ruby
xall has joined #ruby
hotpancakes has joined #ruby
aufi has joined #ruby
hutch34 has joined #ruby
dionysus69 has joined #ruby
Suslov has joined #ruby
TomyWork has joined #ruby
zenguy_pc has quit [Ping timeout: 240 seconds]
hutch34 has quit [Ping timeout: 260 seconds]
brainslug has joined #ruby
xall has quit [Ping timeout: 246 seconds]
okdas has joined #ruby
okdas has joined #ruby
okdas has quit [Changing host]
KnownSyntax has joined #ruby
zenguy_pc has joined #ruby
hotpancakes has quit [Ping timeout: 246 seconds]
xall has joined #ruby
okdas has quit [Ping timeout: 268 seconds]
djbkd has quit []
certainty has joined #ruby
xcesariox has joined #ruby
Suslov has quit [Ping timeout: 256 seconds]
bruce_lee has joined #ruby
tvw has quit [Remote host closed the connection]
ta_ has joined #ruby
minimalism has quit [Quit: minimalism]
TomyWork has quit [Remote host closed the connection]
mark_66 has joined #ruby
evie_hammond has quit [Ping timeout: 240 seconds]
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
tildes has joined #ruby
antgel has joined #ruby
bearbyte has joined #ruby
pwnd_nsfw` has joined #ruby
bear13yte has quit [Ping timeout: 246 seconds]
pwnd_nsfw has quit [Ping timeout: 240 seconds]
nocco has quit [Remote host closed the connection]
nettoweb has joined #ruby
tildes has quit [Ping timeout: 268 seconds]
evie_hammond has joined #ruby
xall has quit [Ping timeout: 260 seconds]
nowhere_man has quit [Quit: Konversation terminated!]
nowhere_man has joined #ruby
xcesariox has quit [Remote host closed the connection]
Mortomes|Work has joined #ruby
xcesariox has joined #ruby
xall has joined #ruby
polysics has joined #ruby
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #ruby
teclator has joined #ruby
okdas has joined #ruby
okdas has joined #ruby
okdas has quit [Changing host]
Arpanet69 has joined #ruby
Burgestrand has joined #ruby
__Yiota has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
JeanCarloMachado has joined #ruby
blaxter has joined #ruby
Silthias has joined #ruby
blaxter has quit [Client Quit]
Silthias2 has joined #ruby
Silthias1 has quit [Ping timeout: 240 seconds]
nocco has joined #ruby
Silthias has quit [Ping timeout: 260 seconds]
JeanCarloMachado has quit [Ping timeout: 258 seconds]
Arpanet69 has quit [Ping timeout: 268 seconds]
nofxxx has joined #ruby
Burgestrand has quit [Quit: Closing time!]
Burgestrand has joined #ruby
charliesome has joined #ruby
mikecmpbll has joined #ruby
nofxx has quit [Ping timeout: 240 seconds]
certainty has quit [Ping timeout: 260 seconds]
jsrn_ has joined #ruby
stoffus_ has joined #ruby
nocco has quit []
hutch34 has joined #ruby
certainty has joined #ruby
bihi has quit [Quit: Bye!]
stoffus has quit [Ping timeout: 256 seconds]
Violentr has joined #ruby
nofxxx has quit [Remote host closed the connection]
nofxx has joined #ruby
xen0fon has quit [Remote host closed the connection]
pawnbox has quit [Remote host closed the connection]
ByronJohnson has quit [Ping timeout: 268 seconds]
pawnbox has joined #ruby
hutch34 has quit [Ping timeout: 246 seconds]
xen0fon has joined #ruby
tomphp has joined #ruby
hotpancakes has joined #ruby
Fridtjof has quit [Ping timeout: 255 seconds]
M107262[m] has quit [Ping timeout: 255 seconds]
TheBrayn has quit [Ping timeout: 255 seconds]
tdy has joined #ruby
mark_66 has quit [Quit: Leaving.]
pandaant has joined #ruby
lxsameer has joined #ruby
Fridtjof has joined #ruby
bear13yte has joined #ruby
ResidentBiscuit has joined #ruby
ByronJohnson has joined #ruby
hotpancakes has quit [Ping timeout: 246 seconds]
Cohedrin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
bearbyte has quit [Ping timeout: 268 seconds]
certainty has quit [Ping timeout: 260 seconds]
nOwz has quit [Ping timeout: 260 seconds]
nettoweb has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
tubuliferous has joined #ruby
ResidentBiscuit has quit [Ping timeout: 246 seconds]
nettoweb has joined #ruby
M107262[m] has joined #ruby
TheBrayn has joined #ruby
nobitanobi has joined #ruby
charliesome has joined #ruby
Arpanet69 has joined #ruby
nOwz has joined #ruby
patarr has joined #ruby
lenwood has joined #ruby
jaruga__________ has joined #ruby
Ruby_Rocks_007 has quit [Quit: Ruby_Rocks_007]
patarr has quit [Ping timeout: 268 seconds]
ThereIsNoYeti has joined #ruby
pawnbox has quit [Ping timeout: 260 seconds]
nettoweb has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
terens has joined #ruby
catpelts has joined #ruby
perry has joined #ruby
perry has quit [Changing host]
perry has joined #ruby
GK___1wm____SU has joined #ruby
ThereIsNoYeti has quit [Ping timeout: 240 seconds]
terens has quit [Remote host closed the connection]
GK___1wm____SU has quit [K-Lined]
perry has quit [Disconnected by services]
ncopa has joined #ruby
Violentr has quit [Ping timeout: 256 seconds]
ljarvis_ is now known as ljarvis
perryh has joined #ruby
perryh has joined #ruby
perryh has quit [Changing host]
teclator has quit [Remote host closed the connection]
dstrunk has joined #ruby
KicStart has joined #ruby
bear13yte has quit [Read error: Connection reset by peer]
aganov has quit [Ping timeout: 240 seconds]
catpelts_ has joined #ruby
bear13yte has joined #ruby
bear13yte has quit [Remote host closed the connection]
pawnbox has joined #ruby
catpelts has quit [Quit: leaving]
Beams has joined #ruby
aganov has joined #ruby
Beams_ has joined #ruby
dstrunk has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
GK___1wm____SU has joined #ruby
dstrunk has joined #ruby
Beams has quit [Ping timeout: 258 seconds]
GK___1wm____SU has quit [K-Lined]
pawnbox has quit [Remote host closed the connection]
jameser_ has quit [Ping timeout: 268 seconds]
pawnbox has joined #ruby
conta has quit [Ping timeout: 264 seconds]
certainty has joined #ruby
sid_fules has joined #ruby
nofxx has quit [Remote host closed the connection]
nofxx has joined #ruby
toretore has joined #ruby
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #ruby
arkaros has joined #ruby
marr has joined #ruby
hutch34 has joined #ruby
<arkaros>
hello i have a question regarding classes. I am pretty new to ruby and accessing class fields with hash syntax confuses me. So you can do both class[:field] and class.field. Are there any requirements for on the class to allow for doing the hash syntax way or is this enabled by default?
<dminuoso>
"So you can do both class[:field] and class.field."
<dminuoso>
arkaros: no you cannot.
<dminuoso>
>> hash = {"a" => 1"}; puts hash.a
<ruby[bot]>
dminuoso: # => /tmp/execpad-809aba613e87/source-809aba613e87:2: syntax error, unexpected tSTRING_BEG, expecting '}' ...check link for more (https://eval.in/751282)
<dminuoso>
>> hash = {"a" => 1}; puts hash.a
<ruby[bot]>
dminuoso: # => undefined method `a' for {"a"=>1}:Hash (NoMethodError) ...check link for more (https://eval.in/751283)
<dminuoso>
arkaros: So what you are talking about must be the behavior of some specific class. What class are you using?
<arkaros>
No i dont mean on hashes i mean classes. I know for sure this works with rails ActiveRecords. You can do both user.id and user[:id]. Is this something that they build into the ActiveRecord class?
<arkaros>
Or is this the behavior of classes in general in ruby?
<dminuoso>
AKPWD: No it is not. This is just ActiveRecord specific.
<dminuoso>
arkaros: ^-
<dminuoso>
arkaros: Mind you, that user.id and user[:id] are not exactly the same either
<arkaros>
dminuoso: Okay so I should probably not make the hash syntax a habit then
<dminuoso>
arkaros: You could if you wanted to, it would be more consistent even.
<dminuoso>
arkaros: Sometimes if there's name clashes you have to do this in fact. Imagine in a column is named "class", now Ruby cannot offer you a .class method for that, because there already is one.
hutch34 has quit [Ping timeout: 260 seconds]
<dminuoso>
So the only way to access that attribute is through [:class]
<arkaros>
dminuoso: Do you have any idea how they made the [:field] syntax work. Did they implement a to_hash method or something?
<dminuoso>
arkaros: Something like that. :-)
polysics_ has joined #ruby
<arkaros>
dminuoso: Thank you for your time. Cleared things up for me :)
<dminuoso>
arkaros: The syntax is just a regular method
<dminuoso>
I can show you:
<dminuoso>
>> class Foo; def [](arg); puts "heey, you called the hash syntax passing #{arg}"; end; end; obj = Foo.new; obj[:foo]
<ruby[bot]>
dminuoso: # => heey, you called the hash syntax passing foo ...check link for more (https://eval.in/751295)
polysics has quit [Ping timeout: 240 seconds]
<dminuoso>
arkaros: So in the end foo[:arg] is actually just a syntactic sugar of: foo.[](:arg)
<elomatreb>
You can even make that method take multiple arguments, which can be really nice for some call signatures
<dminuoso>
arkaros: so it is just a regular method like .quux, except the invocation looks a bit different
<dminuoso>
arkaros: So you can imagine this [:field] syntax to be a better looking version of: object.getAttribute(:field)
<arkaros>
dminuoso: Hmmm really cool. I have started to take a liking to ruby actually. Cool things like that make me happy while programming. I come from a python background but the specific micro service im working on now required parsing of the greenbutton protocol and ruby had a way more sofisticated library for that so now im doing ruby on rails for this hehe
<morfin>
that's called indiffirent access hash as i know
cibs has quit [Ping timeout: 240 seconds]
<elomatreb>
No, that's something else. HashWithIndifferentAccess was/is a crutch to allow [:key] and ["key"] to be the same
Derperperd has quit [Ping timeout: 240 seconds]
<morfin>
ah wait
<dminuoso>
arkaros: Note that the [] method sometimes has different meanings though.
<morfin>
i forgot i saw that in Hashie::Mash or something like that
teclator has joined #ruby
<elomatreb>
>> Hash[ [:key, "value"] ]
<dminuoso>
(It just is a method with peculiar looks, but *most* of the time its just for a "get attribute XYZ" semantics)
<ruby[bot]>
elomatreb: # => /tmp/execpad-02aa9f9040b1/source-02aa9f9040b1:2: warning: wrong element type Symbol at 0 (expected a ...check link for more (https://eval.in/751306)
<elomatreb>
Uh?
workmad3 has joined #ruby
<dminuoso>
Oo
<morfin>
could access like myhash.foo or myhash[:foo] or myhash["foo"]
cibs has joined #ruby
rhyselsmore has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<dminuoso>
>> Hash[ [:key, "value"] ]
<ruby[bot]>
dminuoso: # => /tmp/execpad-62add967371b/source-62add967371b:2: warning: wrong element type Symbol at 0 (expected a ...check link for more (https://eval.in/751307)
<elomatreb>
Oh, they inner ones need to be in another array.
<dminuoso>
elomatreb: I can reproduce that locally.
jeyraof^mbpr has quit [Quit: This computer has gone to sleep]
nofxx has quit [Ping timeout: 240 seconds]
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
xall has quit [Ping timeout: 256 seconds]
biberu has joined #ruby
jamesaxl has joined #ruby
dangerousdave has joined #ruby
<Bish>
can i somehow have the instance variables only set by one ancestor of a class
<Bish>
guess not.. because ruby doesn't log this internally
terens has joined #ruby
terens has quit [Client Quit]
CloCkWeRX has joined #ruby
arkaros has quit [Ping timeout: 258 seconds]
tubuliferous has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cschneid_ has joined #ruby
Paraxial has joined #ruby
cschneid_ has quit [Ping timeout: 246 seconds]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #ruby
hutch34 has joined #ruby
gregf_ has joined #ruby
gnufied has joined #ruby
lenwood has quit [Ping timeout: 268 seconds]
ferr1 has joined #ruby
pawnbox has quit [Ping timeout: 264 seconds]
hutch34 has quit [Ping timeout: 256 seconds]
Derperperd has joined #ruby
certainty has quit [Ping timeout: 240 seconds]
tvw has joined #ruby
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
pawnbox has joined #ruby
hotpancakes has joined #ruby
charliesome has joined #ruby
dstrunk has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ResidentBiscuit has joined #ruby
Beams_ has quit [Quit: .]
tvw has quit [Ping timeout: 264 seconds]
SimpleIRC_VLBcT has quit [Quit: Simple IRC: The quit option.]
Beams has joined #ruby
gnufied has quit [Ping timeout: 246 seconds]
conta has quit [Ping timeout: 240 seconds]
hotpancakes has quit [Ping timeout: 246 seconds]
ResidentBiscuit has quit [Ping timeout: 246 seconds]
JeanCarloMachado has joined #ruby
dstrunk has joined #ruby
ldnunes has joined #ruby
dstrunk has quit [Client Quit]
nadir has quit [Quit: Connection closed for inactivity]
ddffg has joined #ruby
dstrunk has joined #ruby
Silthias has joined #ruby
jaiks has quit [Ping timeout: 246 seconds]
<apeiros>
Bish: indeed no, you can't, for the reason you stated
jshjsh has joined #ruby
patarr has joined #ruby
Silthias2 has quit [Ping timeout: 264 seconds]
jenrzzz has quit [Ping timeout: 240 seconds]
JoshS has quit [Ping timeout: 268 seconds]
patarr has quit [Ping timeout: 246 seconds]
ThereIsNoYeti has joined #ruby
nOwz has quit [Ping timeout: 246 seconds]
mikeiniowa has joined #ruby
tvw has joined #ruby
dstrunk has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ThereIsNoYeti has quit [Ping timeout: 260 seconds]
dstrunk has joined #ruby
jaiks has joined #ruby
jameser has joined #ruby
conta has joined #ruby
Beams has quit [Quit: .]
Beams has joined #ruby
nOwz has joined #ruby
nobitanobi has quit [Remote host closed the connection]
lenwood has joined #ruby
Garo_ has joined #ruby
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #ruby
<Garo_>
I'd like to get a Hash like object which behaves just like Hash, but in addition I could directly set a value into a deep location inside hash without having to create the intermediate hashes in each level. eg. a = {}; a["foo"]["bar"]["baz"] = "test" would just work. Any tips on how to do this?
<Garo_>
I also don't want just monkey patch this feature into Hash itself as it could cause side-effects in other places
certainty has joined #ruby
pawnbox has quit [Ping timeout: 264 seconds]
millerti has joined #ruby
woeb0t has joined #ruby
d0nn1e has quit [Ping timeout: 264 seconds]
d0nn1e has joined #ruby
woeb0t has left #ruby ["ERC (IRC client for Emacs 25.1.1)"]
hutch34 has joined #ruby
Gayathri_ has joined #ruby
tvw has quit [Ping timeout: 256 seconds]
Silthias1 has joined #ruby
tildes has joined #ruby
Silthias has quit [Ping timeout: 268 seconds]
<morfin>
i broke my SSL :)
tonini has quit [Quit: Connection closed for inactivity]
<tildes>
Is it possible to ask a Ruby object for a list of ancestors and mixins?
<morfin>
i remember you could check for includes
hutch34 has quit [Ping timeout: 268 seconds]
<morfin>
or that's not what you want?
<matthewd>
Garo_: That's not really practical; you'd be better off defining a Hash#deep_set
<toretore>
>> p = ->(h,k){ h[k] = Hash.new(&p) }; h = Hash.new(&p); h[:foo][:bar] = 'baz'; h
<matthewd>
Garo_: The impracticality is in how different from Hash your object will feel, because unknown keys always return a new child "hash" instead of nil
<Garo_>
matthewd: I was thinking creating a class based on Hash and then overwriting the [] method to return a new hash if the key is not found
<morfin>
!included_modules
<morfin>
hmm
<Garo_>
matthewd: very trye
anisha has quit [Quit: This computer has gone to sleep]
<morfin>
weird
<morfin>
included_modules gives also modules included from includes?
<tildes>
matthewd: thanks! that seems to give a list which contains both inherited classes and included modules
Silthias has joined #ruby
renatosilva has joined #ruby
<matthewd>
Garo_: Right, you can do that as toretore did, using the builtin hash default feature.. but when I've tried, it just ended up feeling weird -- the fact you want an autovivified hash seems to correlate with wanting to be able to detect when things aren't there, and it seems you can really only get one or the other
<morfin>
i remember even told that in #c++-general :)
<dminuoso>
That smiley you just was the hint. :)
<morfin>
i am wondering why everybody say that Ruby is not pretty scalable
shinnya has joined #ruby
Silthias has quit [Ping timeout: 268 seconds]
TvL2386 has joined #ruby
<morfin>
i know they love Java or even Scala but there was some high load serviceses using Ruby, Memcached, Redis etc
kent\n has joined #ruby
<dminuoso>
morfin: Ruby has 2 main performance problems currently. A) the bytecode is not JITed (not in MRI at least), which means there's very little internal optimization happening
<dminuoso>
morfin: And the other is the so called Global VM Lock, which basically prevents any two threads from concurrently using Ruby basically.
<dminuoso>
morfin: JRuby addresses both however.
cfec0b8d has joined #ruby
<morfin>
GIL?
pawnbox has quit [Remote host closed the connection]
<morfin>
something like Python use
<dminuoso>
morfin: The "GIL" is the old term that stems from when Ruby did not have VM.
pawnbox has joined #ruby
hutch34 has joined #ruby
<morfin>
maybe, anyway Python guys use some global lock as well so concurrent things are not so concurrent
<dminuoso>
morfin: Multithreading mostly only brings benefits if you're using it for blocking I/O, so Ruby is just fine for writing scalable wbe servers for example.
<morfin>
only way to has real concurrency is forking?
^Denis has joined #ruby
<dminuoso>
morfin: For things that contest Ruby functionality, yes.
<dminuoso>
The second you spend time with any syscall the lock is released though.
<dminuoso>
So there's partial applications for threads in Ruby
skweek has joined #ruby
<Bish>
apeiros: too bad!
pawnbox_ has joined #ruby
<dminuoso>
Webservers being one of them.
Silthias has joined #ruby
<dminuoso>
morfin: Or use JRuby.
<morfin>
ah yes - Windows is much worse
certainty has quit [Ping timeout: 240 seconds]
<dminuoso>
morfin: With JRuby you don't have either issue, but even the JIT compilation is limited unless you use jruby-truffle
<morfin>
JRuby just make JVM instructions from Ruby code
<elomatreb>
"just"
<Bish>
google just finds strings in a big string
<morfin>
but what happens to exceptions?
<Bish>
morfin: java has exceptions too, and even if it didn't, you could implement them
<dminuoso>
morfin: So, these points are mostly just about MRI, but if you pick JRuby you can actually write fairly scalable applications.
pawnbox has quit [Ping timeout: 260 seconds]
<morfin>
when i was playing with bytecode i saw how they are implemented in JVM - they wrap whole block in exception an then next block is "catch"
<dminuoso>
But jruby without truffle is still not particularly fast in CPU bound applications, because the JVM cant aggressively optimize rubys dynamic features.
<Bish>
morfin: and then you go to #ruby and ask "what happens to exceptions" :D
<dminuoso>
and graal/truffle is still just a research project I think
pawnbox_ has quit [Remote host closed the connection]
hutch34 has quit [Ping timeout: 260 seconds]
pawnbox has joined #ruby
<morfin>
Bish, i asked because don't know how they're implemented on Ruby
<dminuoso>
morfin: http://jruby.org/bench9000/ #=> there's some benchmarks comparison all the various Ruby implementations using a comprehensive benchmark that focuses on just raw Ruby execution
<morfin>
and JRuby can run on something like JBoss/Tomcat etc right?
Silthias1 has joined #ruby
<morfin>
i.e in Java environment
sleetdrop has quit [Quit: Computer has gone to sleep.]
<morfin>
*in Java environment
Silthias has quit [Ping timeout: 246 seconds]
<dminuoso>
14:22 < morfin> Bish, i asked because don't know how they're implemented on Ruby
<dminuoso>
morfin: setjmp/longjmp
Qchmqs has joined #ruby
<dminuoso>
morfin: and superficially they are just catch/throw
gnufied has joined #ruby
<dminuoso>
(which uses setjmp/longjmp underneath)
Derperperd has quit [Ping timeout: 240 seconds]
<dminuoso>
morfin: You can see this fact in assembly too:
<dminuoso>
asm>> def foo; code; rescue; puts "foo"; end
<ruby[bot]>
dminuoso: I have disassembled your code, the result is at https://eval.in/751451
tubuliferous has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<dminuoso>
morfin: As you can see there's catch sections as soon as there's an exception handler
<morfin>
so big difference between perfomance of VMs
Silthias has joined #ruby
<dminuoso>
morfin: Yes, at the cost of warmup.
<dminuoso>
(Which is probably why JRuby hasnt gained that much traction yet)
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
itsautomatisch has joined #ruby
<morfin>
he-he
conta has joined #ruby
<morfin>
do you remember how big warmup has LLVM?
polyidus has joined #ruby
<dminuoso>
No, I don't do LLVM jit compilation.
<morfin>
Facebook developed HHVM just because of long LLVM warmup times
<dminuoso>
morfin: Ah.
sid_fules has quit [Remote host closed the connection]
<morfin>
and they needed lower times
* Bish
heard llvm should be used for static code, not for jit
<dminuoso>
Bish: Right.
Silthias1 has quit [Ping timeout: 260 seconds]
Silthias1 has joined #ruby
<morfin>
but you will pay every time you compile anyway =)
<dminuoso>
morfin: Honestly that's what we have compile farms for ;p
<chrisseaton>
I don't think it's anything about LLVM that limits it for JIT, but it just doesn't solve the problems you have with a JIT. LLVM helps you emit great low-level code, but if you don't know what code you want to emit it won't help you do that.
<dminuoso>
chrisseaton: I'm genuinely curious. You have a highlight on "truffle" or "graal", don't you?
<chrisseaton>
Rubinius for example emitted LLVM pretty directly 1-for-1 from Ruby code, and LLVM is just never going to optimise that. It doesn't know enough, the code is too low level already, and it wasn't designed to do that at all.
<chrisseaton>
And 'JIT' :)
<dminuoso>
:-)
Silthias has quit [Ping timeout: 240 seconds]
<chrisseaton>
Not stalking, just interested in any discussions on JITing Ruby
polyidus has quit [Ping timeout: 246 seconds]
<morfin>
dminuoso, mmm compile farms nice
<dminuoso>
chrisseaton: So the issue is that a JIT compiler has to understand what the low level code means?
hotpanca_ has joined #ruby
<dminuoso>
(Which if the JIT received "random" llvm code it could not do)
<chrisseaton>
I mean if you emit an LLVM call to malloc, and then read and write a field in that object, LLVM is never going to be able to realise it could just link the read to the write directly and never call malloc.
<chrisseaton>
It will always just do exactly what you told it to do - call malloc - and can't make decisions to do things like remove that call
nettoweb has joined #ruby
conta has quit [Ping timeout: 240 seconds]
teddysmoker has joined #ruby
<dminuoso>
So what kind of optimizations is LLVM good for then? Is it just limited to strength reduction, register allocation, instruction scheduling, etc?
<chrisseaton>
I wouldn't say 'just limited to' because it's still extremely good for it, but yes that's what it does
hotpancakes has quit [Ping timeout: 246 seconds]
<chrisseaton>
You need to already have optimised your language to the point where you could emit machine code yourself, and then LLVM just helps you emit good machine code
<chrisseaton>
You can see lots of examples of people realising this - the FTL backend in Safari had a JS IR and then emitted LLVM instead of their own machine code, the MIR for Rust where before I think they just used LLVM directly, etc
hotpancakes has joined #ruby
griffindy has joined #ruby
troulouliou_div2 has joined #ruby
teddysmoker has quit [Client Quit]
Derperperd has joined #ruby
hotpanca_ has quit [Ping timeout: 260 seconds]
teddysmoker has joined #ruby
<morfin>
hmm
<morfin>
as example in C/C++ compiler try to optimize code then LLVM do rest
<chrisseaton>
C and C++ are already low level though
<chrisseaton>
Transforming Ruby code to the point where it's like C is the problem
patarr has joined #ruby
<morfin>
chrisseaton, but compilers still can do many things to optimize it
<anonymus>
KicStart: that is what I wanted to avoid
<anonymus>
repeating
<matthewd>
anonymus: That's calling .green, which is a different method
<KicStart>
Cleaning it up is left as an exercise to the student. I've proven that it'll work and the correct usage of the colorize gem as matthewd was curious about.
polyidus has joined #ruby
sid_fules has quit [Remote host closed the connection]
<matthewd>
anonymus: I'm asking you about how the .colorize method is intended to be called, and you're telling me you've already decided what the problem is
cpruitt has joined #ruby
polyidus has quit [Client Quit]
jameser has quit [Ping timeout: 258 seconds]
<anonymus>
'qwe'.colorize('green')
<anonymus>
=> "\e[0;39;49mqwe\e[0m"
sid_fules has joined #ruby
polyidus has joined #ruby
rfoust has joined #ruby
ogurk has joined #ruby
nettoweb has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jameser has joined #ruby
<matthewd>
I don't know what that is. It doesn't look like documentation.
<anonymus>
ok, thans
<anonymus>
ok, thanks
<anonymus>
bb
<matthewd>
KicStart has given you a working example, anyway
anonymus has left #ruby ["Once you know what it is you want to be true, instinct is a very useful device for enabling you to know that it is"]
synthroid has joined #ruby
govg has joined #ruby
^Denis has quit [Ping timeout: 240 seconds]
Takumo has quit [Remote host closed the connection]
<ogurk>
trying to set to array variables with ib subnets - and using IPAddr function - basically http://pastebin.com/Cp2M1Hmj
TvL2386 has quit [Remote host closed the connection]
choke has joined #ruby
csk has quit [Ping timeout: 260 seconds]
<dminuoso>
morfin: As I said.
<dminuoso>
13:56 < dminuoso> So: class Base < Derived; prepend Mod; end; #=> Mod < Derived < Base
SteenJobs has quit [Ping timeout: 256 seconds]
<dminuoso>
morfin: When you prepend, you basically say: "Despite the fact that I just create a Derived object, it's will act as if it was a Mod first, and a Derived second.
Bish has quit [Ping timeout: 260 seconds]
SteenJobs has joined #ruby
csk has joined #ruby
Bish has joined #ruby
<dminuoso>
morfin: "ancestors" is the actual inheritance chain (and thus used for method dispatch), use it after you include and prepend modules into a class.
nadir has joined #ruby
<dminuoso>
morfin: Note: there's virtually no difference between a module and a class, so you can view them as the same thing.
dionysus69 has quit [Ping timeout: 240 seconds]
cschneid_ has joined #ruby
choke has quit [Ping timeout: 240 seconds]
<dminuoso>
The only differences are that modules dont have .allocate and .new, and that classes can't be included/prepended/extended #=> but these restrictions are completely arbitrary.
<dminuoso>
(i.e. you could modify the ruby interpreter to remove these restrictions and then use them completely interchangably)
SteenJobs has quit [Ping timeout: 256 seconds]
ozcanesen has joined #ruby
<dminuoso>
For example when you write: class Foo < Bar; end; it's pretty much the same as: class Foo; include Bar; end;
mustmodify has joined #ruby
<mustmodify>
anyone know why yaml files start with three dashes?
SteenJobs has joined #ruby
<allisio>
They don't have to, but it's because one .yml file can contain many disparate "documents".
igniting has joined #ruby
<allisio>
And that's the separator.
Bish has quit [Ping timeout: 240 seconds]
brent__ has joined #ruby
lenwood has quit [Ping timeout: 260 seconds]
SteenJobs has quit [Ping timeout: 264 seconds]
bmurt has joined #ruby
Bish has joined #ruby
hxegon has quit [Disconnected by services]
hxegon has joined #ruby
duderonomy has quit [Ping timeout: 268 seconds]
brent__ has quit [Remote host closed the connection]
bmurt has quit [Client Quit]
brent__ has joined #ruby
<mustmodify>
I see.
<mustmodify>
Thanks.
BlueDragons has joined #ruby
aufi has quit [Quit: Leaving]
SteenJobs has joined #ruby
Suslov has joined #ruby
Lord_of_Life has quit [Excess Flood]
bmurt has joined #ruby
BlueDragons has quit [Read error: Connection timed out]
BlueDragons has joined #ruby
Lord_of_Life has joined #ruby
Suslov has quit [Ping timeout: 268 seconds]
Suslov has joined #ruby
BlueDragons has quit [Client Quit]
hxegon has quit [Quit: leaving]
hxegon has joined #ruby
hxegon has quit [Client Quit]
sepp2k has joined #ruby
hxegon has joined #ruby
hxegon has quit [Client Quit]
chopin has joined #ruby
hxegon has joined #ruby
hxegon has quit [Client Quit]
hxegon has joined #ruby
hxegon has quit [Client Quit]
hxegon has joined #ruby
Derperperd has quit [Max SendQ exceeded]
skweeke has joined #ruby
skweek has quit [Read error: Connection reset by peer]
Derperperd has joined #ruby
Suslov has quit [Quit: Leaving...]
sneakerhax has quit [Ping timeout: 268 seconds]
SteenJobs has quit [Ping timeout: 258 seconds]
ThereIsNoYeti has joined #ruby
ThereIsNoYeti has quit [Remote host closed the connection]
tubuliferous has joined #ruby
ThereIsNoYeti has joined #ruby
Arpanet69 has quit [Ping timeout: 240 seconds]
troulouliou_div2 has quit [Quit: Leaving]
xen0fon has joined #ruby
hotpanca_ has joined #ruby
ferr1 has quit [Quit: WeeChat 1.7]
xen0fon has quit [Quit: xen0fon]
Gayathri_ has quit []
cdg has joined #ruby
ferr1 has joined #ruby
Gayathri_ has joined #ruby
Derperperd has quit [Max SendQ exceeded]
Gayathri_ has left #ruby [#ruby]
amclain has joined #ruby
szulak_ has joined #ruby
s2013 has joined #ruby
hyuvkr has joined #ruby
teclator has quit [Remote host closed the connection]
ferr1 has quit [Quit: WeeChat 1.7]
jsrn_ has quit [Quit: Leaving]
Lord_of_Life has quit [Excess Flood]
Lord_of_Life has joined #ruby
esObe_ has quit [Remote host closed the connection]
esObe_ has joined #ruby
esObe__ has joined #ruby
esObe_ has quit [Read error: Connection reset by peer]
xall has quit [Ping timeout: 240 seconds]
BackEndCoder has quit [Excess Flood]
Arpanet69 has joined #ruby
esObe__ has quit [Ping timeout: 264 seconds]
BackEndCoder has joined #ruby
catphish has quit [Quit: Leaving]
pawnbox has quit [Remote host closed the connection]
pawnbox has joined #ruby
Derperperd has joined #ruby
nowhere_man has joined #ruby
pawnbox has quit [Ping timeout: 264 seconds]
VladGh has quit [Read error: Connection reset by peer]
VladGh has joined #ruby
gusrub has joined #ruby
jaiks has quit [Quit: Leaving]
jyaworski has joined #ruby
Cohedrin has joined #ruby
username1 has joined #ruby
username1 has quit [Client Quit]
iceden has quit [Ping timeout: 260 seconds]
dangerousdave has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
skweeke has quit [Ping timeout: 240 seconds]
VladGh has quit [Remote host closed the connection]
VladGh has joined #ruby
jyaworski has quit [Read error: Connection reset by peer]
flying has quit []
Cohedrin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
mikecmpbll has quit [Ping timeout: 240 seconds]
andikr has quit [Remote host closed the connection]
hotpanca_ has quit [Remote host closed the connection]
hotpanca_ has quit [Remote host closed the connection]
cibs has quit [Ping timeout: 240 seconds]
cibs has joined #ruby
Cohedrin has joined #ruby
Macrobiotic has joined #ruby
schickung has quit [Quit: schickung]
hyuvkr has quit [Remote host closed the connection]
tildes_ has joined #ruby
esObe_ has joined #ruby
banisterfiend has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
ahrs has quit [Remote host closed the connection]
jyaworski has quit [Read error: Connection reset by peer]
ahrs has joined #ruby
jyaworski has joined #ruby
sid_fules has quit [Remote host closed the connection]
chouhoulis has quit [Remote host closed the connection]
Coldblackice has joined #ruby
greenbird has joined #ruby
hahuang61 has joined #ruby
hooper has joined #ruby
<leah2>
why?
<marchelzo>
leah2: i had flashbacks to C++ while reading it
enterprisey has joined #ruby
<leah2>
except that c++ has a spec :P
<marchelzo>
the rules for linearization, name lookup, assigning arguments to parameters are just insanely complicated
<leah2>
yes, and you never need them for non contrived code
<leah2>
and the parameters are quite intuitive...
<marchelzo>
still it's worrying
<marchelzo>
all of the complexity just lurking in the background of the language is unsettling
<marchelzo>
i like to understand the language i'm writing in
Derperperd has quit [Max SendQ exceeded]
jaruga__________ has quit [Quit: jaruga__________]
Derperperd has joined #ruby
djbkd has joined #ruby
pandaant has quit [Remote host closed the connection]
Burgestrand has quit [Quit: Closing time!]
<matthewd>
Seems more like complicated descriptions to me
gusrub has quit [Remote host closed the connection]
<allisio>
leah2: Ruby has a spec.
xen0fon has joined #ruby
<matthewd>
It seems to be providing a fairly exhaustive exploration of how the various simple, not-complex, rules interact to produce complex-looking behaviours
pawnbox has joined #ruby
montanonic has joined #ruby
<marchelzo>
allisio: does it? he mentioned in the article that 1.8 has a spec, but e.g., 2.4 is not specified anywhere
<leah2>
by people who don't the the main interpreter?
mikecmpbll has joined #ruby
<leah2>
correct me if i'm wrong :P
<marchelzo>
"executable specification" is not that useful lol
<allisio>
JRuby tries to conform to it, at any rate.
<matthewd>
"spec" seems pretty strong
SteenJobs_ has joined #ruby
zeroDi has joined #ruby
ramfjord has joined #ruby
<matthewd>
Strictly speaking, ruby has a spec in the form of the MRI source - but that's also less than entirely helpful in practice
<leah2>
yes ;)
<allisio>
What does "less than entirely helpful" mean?
<marchelzo>
useless
<leah2>
you never know if its a bug in mri or a language feature
<matthewd>
Depends what you want the spec for
<matthewd>
If you want to prove that a given implementation is conforming, then rubyspec can help you
<havenwood>
leah2: CRuby incorporated a fork of RubySpec. The original RubySpec went internal to Rubinius.
<leah2>
yeah, but if you want to be a language lawyer, you need to read the source anyway :)
<allisio>
And so all is well.
<matthewd>
If you want something coherent to read to better understand partially-emergent behaviours, reading rubyspec doesn't seem much easier than just reading ruby/ruby
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Ruby_Rocks_007 has joined #ruby
<marchelzo>
matthewd: "[...] how the various simple, not-complex, rules interact [...]"
<marchelzo>
they really don't seem to be simple
<leah2>
i didnt read much mri since 1.9, but back then it was quite straight-forward to find things
<allisio>
They're... intricate.
<allisio>
It's still pretty straightforward.
<leah2>
and obviously some rules are just sideeffects of implementation
SteenJobs_ has quit [Ping timeout: 256 seconds]
certainty has quit [Ping timeout: 240 seconds]
lxsameer has quit [Quit: WeeChat 1.5]
<matthewd>
The module linearization article, particularly, seemed like a lot of words (which I heavily glossed over) for an implementation that's really pretty straightforward and consistently predictable
AndBobsYourUncle has joined #ruby
<marchelzo>
matthewd: "For seemingly no good reason, you cannot have an array decomposition parameter, a splat parameter and a keyword parameter in the same method."
<marchelzo>
how do you explain that as an interaction of simple rules?
<marchelzo>
it seems like just an arbitrary limitation
<marchelzo>
allisio: that doesn't change my concern
<allisio>
Find your inner utilitarian.
<matthewd>
Yeah, that sounds like an implementation quirk -- or possibly a bug
<allisio>
It's an oversight that has no cause to be addressed.
SteenJobs_ has joined #ruby
gusrub has joined #ruby
<matthewd>
But "complexity" doesn't feel like the right way to describe it -- it's not a special rule to be remembered (as it would be if there *was* a seeming reason)
gusrub has quit [Client Quit]
tau has quit [Remote host closed the connection]
gusrub has joined #ruby
<allisio>
marchelzo: For what it's worth, the article is flat-out lying/mistaken: https://eval.in/751655
<hxegon>
marchelzo: 175-187 is a nested conditional that basically checks the same thing for 3 different paths, and all paths do the same thing, which is run what I believe to be an ActiveRecord callback
<hxegon>
if autosave ... > if autosave ... < elsif autosave
hotpancakes has joined #ruby
<marchelzo>
hxegon: they don't do the same thing though
<marchelzo>
if autosave != false is not the same as if autosave
<hxegon>
marchelzo: ah I see that now, :create vs :update
hotpancakes has quit [Read error: Connection reset by peer]
hotpancakes has joined #ruby
SeepingN has joined #ruby
certainty has quit [Ping timeout: 264 seconds]
blackwind_123 has quit [Quit: If you can't laugh at yourself, make fun of other people.]
<hxegon>
but it's the same effect because the only thing it does is run if autosave after that right?
nOwz has quit [Quit: WeeChat 1.7]
SteenJobs_ has joined #ruby
<hxegon>
cek: Didn't know there were python -> ruby translators, very possible since what this project deals with, OpenERP, is in python
AndBobsYourUncle has joined #ruby
jackjackdripper has joined #ruby
<dminuoso>
20:50 < marchelzo> if autosave != false is not the same as if autosave
<dminuoso>
marchelzo: that's what makes it so horrible
chouhoul_ has quit [Remote host closed the connection]
chouhoulis has joined #ruby
<dminuoso>
This means to say: if autosave.nil? ... elsif autosave
<dminuoso>
toretore: mine.rb is the simplified version and carries the same semantics
<dminuoso>
if autosave is false, it will return. if its nil, it will return.
SteenJobs_ has quit [Ping timeout: 246 seconds]
<dminuoso>
well okay, it should be next actually
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<toretore>
you are missing a record.run_callbacks(:update) {false}
<dminuoso>
mmm k
<dminuoso>
let me fix and refactor more
hutch34 has quit [Ping timeout: 258 seconds]
<dminuoso>
toretore: refresh
<allisio>
cek: There's simply no way to pass multiple "braced blocks" to a method, and all of the ways to "chain" Procs are fairly gruesome.
<dminuoso>
Chaining procs is easy. just turn them into HOF and return new lambdas? :P
Macrobiotic has quit [Quit: Connection closed for inactivity]
Arpanet69 has quit [Ping timeout: 260 seconds]
<hxegon>
Trying to use procs too much kind of gets to me. They are like 0.999999 class citizens
ResidentBiscuit has joined #ruby
<ResidentBiscuit>
I've got a vagrant box with rvm installed for my vagrant user. I like to have multiple ssh sessions so I can run a rails server, do git things, rake tests, etc all at once. Multiplexers have been not friendly towards conemu. RVM doesn't like to work very well in this situation, though. Each session seems to operate with its own gemset, bundle insta
<ResidentBiscuit>
ll/updates will fail on all but the first session. Is there something extra I need to do to make this work?
<ResidentBiscuit>
When working on my mac and just splitting iterm, I don't have this issue. I'm guessing it's something to do with how I'm ssh-ing into the vagrant box
<allisio>
You can do away with the parentheses on 2.4+ in case that's relevant.
pawnbox has quit [Remote host closed the connection]
<cek>
that was the question, whether new versions have more support in regards to syntax mangling
pawnbox has joined #ruby
<allisio>
That you're unironically calling it "mangling" should give you pause.
SteenJobs_ has joined #ruby
chopin has quit [Remote host closed the connection]
bruce_lee has quit [Remote host closed the connection]
gloscombe has joined #ruby
banisterfiend has joined #ruby
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
MasterRex has joined #ruby
<MasterRex>
Hi folks, can anyone explain how Bundler enforces scripts to use gems installed for a given bundle?
mula has joined #ruby
SteenJobs_ has quit [Ping timeout: 240 seconds]
<MasterRex>
I.e. if I `bundle install --gemfile Gemfile` and it puts a .bundle/config in place... what makes any ruby code execute respect that config?
<matthewd>
MasterRex: It overrides rubygems internals
<MasterRex>
matthewd: so as long as "bundler" is required within a project that has a sibling .bundle/config or Gemfile.lock.... it'll respect the .bundle/config ?
<MasterRex>
I am failing to find any documentation that states how it actually works or what it enforces, just a lot of fluff
<hxegon>
ResidentBiscuit: Just speculation, but I imagine most people here use rbenv or chruby, which might be why you aren't getting help.
<matthewd>
"how it actually works" is documented in the implementation ¯\_(ツ)_/¯
<cek>
cout: yeah, that's some crazy shit. I'd better stick with regular if then else drama
<ResidentBiscuit>
hxegon: That could be, I never know which is the flavor of the month
<cout>
cek: it's basically the same as what you wanted to do, but with an explicit receiver, so f.if instead of if?
solocshaw has joined #ruby
govg has quit [Ping timeout: 260 seconds]
<hxegon>
ResidentBiscuit: If it's not possible (or you just don't want) to switch, I'd suggest taking another crack at getting a multiplexer to work.
itsautomatisch has joined #ruby
govg has joined #ruby
<ResidentBiscuit>
It _works_, just lots of graphical bugs with conemu
<ResidentBiscuit>
For example, just going into vim totally breaks the status bar and screws up the cursor position in all of the panes somehow
pawnbox has quit [Remote host closed the connection]
<ResidentBiscuit>
Maybe I'll just switch to rbenv. I've always found rvm to be easier to use, but only being able to run one shell at a time is silly
skweeke has quit [Ping timeout: 256 seconds]
hotpanca_ has joined #ruby
GodFather has quit [Read error: Connection reset by peer]
SteenJobs_ has joined #ruby
hotpancakes has quit [Ping timeout: 246 seconds]
nobitanobi has joined #ruby
SteenJobs_ has quit [Ping timeout: 260 seconds]
enterprisey has joined #ruby
tomphp has joined #ruby
enterprisey has quit [Read error: Connection reset by peer]
__Yiota has quit [Ping timeout: 246 seconds]
xzhao has quit [Remote host closed the connection]
vuoto has quit [Remote host closed the connection]
xzhao has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
SteenJobs_ has joined #ruby
pawnbox has joined #ruby
montanonic has quit [Ping timeout: 264 seconds]
nowhere_man has quit [Ping timeout: 246 seconds]
nobitanobi has quit [Ping timeout: 240 seconds]
tildes_ has quit [Ping timeout: 240 seconds]
synthroid has quit [Remote host closed the connection]
ozcanesen has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ozcanesen has joined #ruby
pawnbox has quit [Ping timeout: 240 seconds]
conta has quit [Ping timeout: 240 seconds]
rhyselsmore has joined #ruby
certainty has joined #ruby
bg has joined #ruby
nowhere_man has joined #ruby
SteenJobs_ has quit [Ping timeout: 258 seconds]
__Yiota has joined #ruby
solocshaw has quit [Ping timeout: 246 seconds]
SteenJobs_ has joined #ruby
hutch34 has joined #ruby
ozcanesen has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
montanonic has joined #ruby
nebben has joined #ruby
Rodya_ has joined #ruby
ozcanesen has joined #ruby
hutch34 has quit [Ping timeout: 246 seconds]
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
SteenJobs_ has quit [Ping timeout: 240 seconds]
anjen has joined #ruby
anjen has quit [Read error: Connection reset by peer]
catphish has joined #ruby
SteenJobs_ has joined #ruby
loechel has joined #ruby
loechel has quit [Client Quit]
Pumukel has quit [Ping timeout: 240 seconds]
tau is now known as alphahunter
SteenJobs_ has quit [Ping timeout: 260 seconds]
szulak has joined #ruby
jenrzzz has joined #ruby
hutch34 has joined #ruby
catpelts has quit [Quit: ZNC 1.6.3+deb1 - http://znc.in]
SteenJobs_ has joined #ruby
catpelts has joined #ruby
alphahunter is now known as mumm-ra
workmad3 has joined #ruby
mumm-ra is now known as rolls
hutch34 has quit [Ping timeout: 240 seconds]
conta has joined #ruby
chopin has joined #ruby
ujjain has quit [Read error: Connection reset by peer]
workmad3 has quit [Ping timeout: 260 seconds]
fns has joined #ruby
<fns>
anyone running on windows, able to tell me what ENV['PATH'] looks like?
chopin_ has joined #ruby
chopin has quit [Read error: Connection reset by peer]
Limix has joined #ruby
<Limix>
Hi all, anyone ever get a “Too many open files” error? Just started randomly happening after about a month of not touching the running app. Wondering if I am not properly closing a file after creating. Do I need to manually close? Currently I am just: File.delete(path)
<fns>
ack
<fns>
that tells the OS to delete the path
ElDoggo has joined #ruby
JeanCarloMachado has quit [Ping timeout: 260 seconds]
skweeke has joined #ruby
<fns>
i would still close the file descriptor, though i have not tested if it is necessary
<fns>
keep in mind most OS hold files around if there is an open reference
<Limix>
I see, thank you that must be it.
certainty has quit [Ping timeout: 256 seconds]
ldnunes has quit [Quit: Leaving]
<Limix>
How would you do the following so that it could be closed after: ERB.new(File.open("app/views/emails/#{erb}.erb").read).result(binding)
<Limix>
Thinking this is the culprit, how would I close this?
lupine has joined #ruby
<Limix>
Is there a way to see how many files are currently open in the ruby process? Also, how could I close all the old connections? Will a restart be the only way?
SteenJobs_ has quit [Ping timeout: 268 seconds]
ujjain has joined #ruby
ujjain has quit [Changing host]
ujjain has joined #ruby
<fns>
what OS?
<allisio>
Limix: Just use `File.read` there.
<fns>
i am not sure if what ruby thinks, matters
<fns>
unix-y, try lsof
<Limix>
allisio: so ERB.new(File.read("app/views/emails/#{erb}.erb")).result(binding) will work?
SteenJobs_ has joined #ruby
postmodern has joined #ruby
<allisio>
Limix: `File.read(foo)` is `File.open(foo).read` without the dangling descriptor, yes.
dionysus69 has quit [Remote host closed the connection]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dionysus69 has joined #ruby
<bg>
does ruby have RAII
catphish has left #ruby ["Leaving"]
<bg>
lol
<allisio>
Sort of.
<bg>
does ruby have scope-based resource management, is what i mean
<allisio>
Not in the general case.
<Limix>
allisio, ok cool, and I’m assuming it will handle cleanup?
<allisio>
But, for instance, `File.open` with a block will indeed close the file once the block exits.
<bg>
and what if the block raises an exception
<allisio>
Bad things.
<allisio>
For that there's `ensure`.
<bg>
File.ensure?
<allisio>
No, it's a keyword that forces the interpreter to execute its associated body.
<bg>
like finally?
hxegon has quit [Quit: leaving]
<allisio>
Yeah.
hahuang61 has joined #ruby
hxegon has joined #ruby
<allisio>
I think `File.open` does actually use it to ensure the file gets closed, though.
<bg>
i would hope so
<bg>
can i learn ruby on video
<allisio>
Not well.
<bg>
i love listening to videos
<Limix>
allisio But the way I am doing it, outside a block is probably not closing it?
<hxegon>
bg: like, by watching youtube videos?
SteenJobs_ has quit [Ping timeout: 264 seconds]
<bg>
hxegon: that's exactly tight
<allisio>
Limix: Definitely not.
kobain has joined #ruby
<bg>
exactly right*
<bg>
lol
<hxegon>
bg: You can learn some stuff, but practice is the most important thing.
<bg>
i mean i just want some video recommendations
<bg>
i love listening -- hate practicing
<hxegon>
bg: rubytapas is great, not free, but really good
MasterRex has quit [Ping timeout: 240 seconds]
SteenJobs_ has joined #ruby
<hxegon>
bg: you have to practice. Figure out something you'd find useful and build it
<bg>
i will learn through listening only and see where that gets me
<bg>
we'll see where things stand in a month
tildes_ has joined #ruby
<bg>
$18/month for some fucking ruby videos?
<hxegon>
they are really good.
<bg>
"gourmet ruby"
<hxegon>
and that's a library of about... 400+? episodes
<bg>
i just don't have the means right now
<hxegon>
that go in depth, are clear and concise, well produced.
dionysus69 has quit [Ping timeout: 260 seconds]
<hxegon>
Understandable, let me see what else I can pull up from my bookmarks...
Lord_of_Life has quit [Excess Flood]
tystr has quit [Ping timeout: 246 seconds]
tyang_ has joined #ruby
synthroid has joined #ruby
nowhere_man has quit [Quit: Konversation terminated!]
<hxegon>
bg: Are you just starting off, do you have any previous programming experience, have you learned the basics of ruby syntax yet?
synthroid has quit [Client Quit]
nowhere_man has joined #ruby
<bg>
i'm very experienced
<bg>
and i know the basics
<Limix>
fns, thank you. When I run lsof, I get about 2000+ of:
<Limix>
1)one who's inferior intelligence results in them making a complete titface out of themselves in public
SteenJobs_ has joined #ruby
<hxegon>
and if you search youtube for "sandi metz ruby" I see... about 4 hours of conf talks from her
<bg>
very very nice
<bg>
thank you
tildes_ has quit [Ping timeout: 260 seconds]
<bg>
i will be a ruby god in short order
<hxegon>
no problem. her book is really good too.
byte512 has quit [Ping timeout: 264 seconds]
moei has quit [Quit: Leaving...]
moei has joined #ruby
SteenJobs_ has quit [Ping timeout: 240 seconds]
Derperperd has joined #ruby
jenrzzz has quit [Ping timeout: 256 seconds]
<fns>
limix lol please read man page or --help etc before getting all confused :)
<fns>
i think it is -p PID but not certain without checking
SeepingN has quit [Ping timeout: 260 seconds]
djbkd has joined #ruby
SeepingN has joined #ruby
mula has joined #ruby
Ruby_Rocks_007 has joined #ruby
Ruby_Rocks_007 has quit [Client Quit]
gigetoo has quit [Read error: Connection reset by peer]
gigetoo has joined #ruby
rolls has quit [Remote host closed the connection]
bg has quit [Remote host closed the connection]
bg has joined #ruby
mula has quit [Remote host closed the connection]
pawnbox has joined #ruby
Derperperd has quit [Quit: WeeChat 1.5]
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
SteenJobs_ has joined #ruby
tvw has joined #ruby
^Denis has quit [Ping timeout: 240 seconds]
pawnbox has quit [Ping timeout: 258 seconds]
koneko has quit [Ping timeout: 264 seconds]
cschneid_ has joined #ruby
^Denis has joined #ruby
^Denis has quit [Client Quit]
SteenJobs_ has quit [Ping timeout: 256 seconds]
SteenJobs_ has joined #ruby
fns has left #ruby [#ruby]
__Yiota has quit [Read error: Connection reset by peer]
hahuang65 has quit [Quit: WeeChat 1.5]
__Yiota has joined #ruby
cschneid_ has quit [Ping timeout: 246 seconds]
bmurt has joined #ruby
ramortegui has quit [Remote host closed the connection]
CloCkWeRX has joined #ruby
ddffg has quit [Quit: Leaving]
SeepingN has quit [Read error: Connection reset by peer]
SeepingN_ has joined #ruby
bheesham has joined #ruby
VladGh has quit [Remote host closed the connection]
mula has joined #ruby
VladGh has joined #ruby
koneko has joined #ruby
Snickers has quit [Quit: Snickers]
SteenJobs_ has quit [Ping timeout: 256 seconds]
Ruby_Rocks_007 has joined #ruby
ule has quit [Ping timeout: 252 seconds]
SteenJobs_ has joined #ruby
ule has joined #ruby
nowhere_man has quit [Ping timeout: 258 seconds]
SteenJobs_ has quit [Ping timeout: 256 seconds]
SteenJobs_ has joined #ruby
marxarelli is now known as marxarelli|afk
sid_fules has joined #ruby
szulak has quit [Quit: My MacBook Air has gone to sleep. ZZZzzz…]
SteenJobs_ has quit [Ping timeout: 256 seconds]
SteenJobs_ has joined #ruby
<graft>
ok i'm trying to write operators for my Vector class, I want to be able to do Vector / Vector and Numeric / Vector and Vector / Numeric
<graft>
for the first and last i can just use def /(vec_or_number), but the latter requires me to patch Numeric
enterprisey has quit [Remote host closed the connection]
<graft>
instead we're supposed to override 'coerce' in Vector, which will result in Numeric calling Vector#/(Numeric) if it can't figure out how to deal with Vector
yqt has quit [Ping timeout: 260 seconds]
<graft>
but... division isn't commutative, so this won't work?
hxegon is now known as hxegon_afk
<graft>
any idee how i can do 3 / vector and vector / 3?
sneakers has joined #ruby
SteenJobs_ has quit [Ping timeout: 240 seconds]
pawnbox has joined #ruby
Limix has quit [Quit: Limix]
SteenJobs_ has joined #ruby
fullstack has quit [Ping timeout: 258 seconds]
pawnbox has quit [Ping timeout: 260 seconds]
montanonic has quit [Ping timeout: 240 seconds]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]