apeiros_ changed the topic of #ruby-lang to: Ruby 2.1.2; 2.0.0-p481; 1.9.3-p545: http://ruby-lang.org || Paste >3 lines of text on http://gist.github.com
ur5us has quit [Remote host closed the connection]
devgiant has quit [Quit: Leaving]
<apeiros> >> :object_id.to_proc
<eval-in_> apeiros => #<Proc:0x41eaa560> (https://eval.in/169751)
<apeiros> it calls to_proc on it. which returns a Proc instance.
<apeiros> >> :object_id.to_proc.call(nil)
<eval-in_> apeiros => 4 (https://eval.in/169752)
<apeiros> >> nil.object_id
<eval-in_> apeiros => 4 (https://eval.in/169753)
malconis has quit [Quit: Textual IRC Client: www.textualapp.com]
malconis has joined #ruby-lang
<ju> I will study this, thanks to you !
hguzman has joined #ruby-lang
<hguzman> Hola
<ju> mmm but why 4 id return... ?
<hguzman> Quien me puede ayudar con algo de rails
<hguzman> ???
malconis has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<hguzman> Holaaa
yubrew has joined #ruby-lang
wallerdev has joined #ruby-lang
<hguzman> hola
<hguzman> Alguien me puede ayudar
<hguzman> ???
<apeiros> hguzman: the channel language is english
ddv has quit [Ping timeout: 245 seconds]
<apeiros> there are other channels for other languages
yubrew has quit [Ping timeout: 244 seconds]
ddv has joined #ruby-lang
matp has quit [Ping timeout: 240 seconds]
<apeiros> ju: nil's object_id is 4. always. has to do with how it's implemented
malconis has joined #ruby-lang
<apeiros> there are a couple of other objects with fixed object_ids (true, false, most fixnums)
mistym has joined #ruby-lang
earthquake has quit [Quit: earthquake]
snsei has quit [Remote host closed the connection]
lolmaus has quit [Ping timeout: 240 seconds]
snsei has joined #ruby-lang
theharshest has quit [Quit: This computer has gone to sleep]
<ju> apeiros > Tanks very much
<ju> See you later !
* apeiros 's tanks roll on to the next city
marr has quit []
snsei has quit [Ping timeout: 255 seconds]
ju has quit []
earthquake has joined #ruby-lang
malconis has quit [Quit: Textual IRC Client: www.textualapp.com]
theharshest has joined #ruby-lang
theharshest has quit [Client Quit]
symm- has quit [Ping timeout: 255 seconds]
enebo has joined #ruby-lang
postmodern has joined #ruby-lang
toretore has quit [Quit: This computer has gone to sleep]
theharshest has joined #ruby-lang
hguzman has quit [Quit: Saliendo]
momomomomo has joined #ruby-lang
weems|mac has quit [Quit: weems|mac]
jeffs has joined #ruby-lang
lolmaus has joined #ruby-lang
jeffs has quit [Ping timeout: 248 seconds]
weems|mac has joined #ruby-lang
wallerdev has quit [Quit: wallerdev]
stamina has quit [Ping timeout: 260 seconds]
<ericwood> what's the cool ruby docs tool to use these days?
<ericwood> also, what do the official ruby docs use?
saarinen has joined #ruby-lang
<ericwood> just kidding the official ones are ruby-doc rdoc
saarinen has quit [Client Quit]
yubrew has joined #ruby-lang
yubrew has quit [Ping timeout: 260 seconds]
wallerdev has joined #ruby-lang
momomomomo has quit [Quit: momomomomo]
wallerdev has quit [Quit: wallerdev]
mikecmpbll has quit [Quit: i've nodded off.]
weems|mac has quit [Quit: weems|mac]
tectonic has joined #ruby-lang
cmoneylulz has joined #ruby-lang
sarkyniin has quit [Quit: Quitte]
rau has joined #ruby-lang
duderonomy has quit [Quit: Textual IRC Client: www.textualapp.com]
karamazov has joined #ruby-lang
btcftw21 has joined #ruby-lang
btcftw21 is now known as breezy
ruby-lang616 has joined #ruby-lang
cmoneylulz has quit [Remote host closed the connection]
<ruby-lang616> hey Ruby community, I have a question about hashes vs. arrays
<ruby-lang616> Why use a hash vs. an array?
<ruby-lang616> is it b/c they allow you to associate objects with other objects rather than being limited to just an integer with an object (array)
<ruby-lang616> ?
<red_menace> depends on what you are doing, I suppose
weems|mac has joined #ruby-lang
<ruby-lang616> but, I guess as a general topic in explaining what a hash is and then why to use one vs. an array?
<apeiros> hashes allow you to use almost any object as a key, also they're "sparse". only keys you actually set are in it
deg- has quit [Ping timeout: 264 seconds]
<red_menace> an array is an ordered collection of items that are accessed by their position (index) in the list
<apeiros> arrays are positional. you access items by position.
<red_menace> a hash is an unordered collection of items that are accessed by a key value
<apeiros> an array is not sparse. if you do `x = []; x[1000000] = 1`, your array will contain 1000001 items.
<apeiros> red_menace: small correction: ruby hashes are ordered
<apeiros> they're, however, not meant for positional access. order is achieved through linking.
<ericwood> yes
<ericwood> iteration will preserve order
deg- has joined #ruby-lang
<red_menace> by unordered I was referring to the key/value pairs not being in any specific order
<apeiros> red_menace: I understand. but they are.
<apeiros> they retain insertion order. which is a specific order.
<ericwood> it's best not to assume order when working with ruby hashes, even though they are ordered
<ruby-lang616> gotcha
<ericwood> although there are certain circumstances where that's acceptable
<ruby-lang616> so, I suppose the use of a hash vs. an array really depends on the data you want to store? If I want to store a list of students I could use an array, but if I want to store names of students associated with their grades, it seems to me like I would use a hash
<ruby-lang616> so I could have a name (string) associated with a grade (string) and order doesn't really matter to me
<apeiros> ruby-lang616: no. it depends on how you want to access the data you store.
<apeiros> you can store any kind of objects in both.
<ericwood> apeiros: you can use hashes as keys I found out recently
<ericwood> ain't that messed up?
<ruby-lang616> haha
<apeiros> ericwood: as said, you can use almost every object
theharshest has quit [Quit: This computer has gone to sleep]
<apeiros> the only requirement is #hash and #eql? being implemented properly
<ruby-lang616> so when do you guys use hashes instead of arrays?
<ericwood> when I'm storing data that's associated to some other value
<ericwood> think of it like a phone book
<apeiros> ruby-lang616: when I need to access my data by key, or when it's sparse
<ericwood> I have a bunch of people with phone numbers? perfect use for a hash, assuming I'm looking up phone numbers by name
<ruby-lang616> ah, I see
<ruby-lang616> and then what would a prototypical use for an array be?
<ericwood> a collection of potentially ordered data
jxpx777 has joined #ruby-lang
<apeiros> a list of all users in an irc channel
<apeiros> a list of all channels on an irc server
<apeiros> a list of all messages sent in a channel
<ruby-lang616> gotcha, there is a prime example to my right lol
<red_menace> while a hash could be a collection of those
<ruby-lang616> okay, I think it is becoming clear...thank you!
<apeiros> an array of arrays of pixels of your picture
<ruby-lang616> when you say a hash could be a collection of those...what would the key/value pair be in that case?
<apeiros> nickname => user
<apeiros> channelname => channel
<ruby-lang616> gotcha
theharshest has joined #ruby-lang
<ruby-lang616> thank you for your help with this
katlogic_ has joined #ruby-lang
matp has joined #ruby-lang
breezy_ has joined #ruby-lang
karamazov has quit [Remote host closed the connection]
breezy has quit [Ping timeout: 272 seconds]
jxpx777 has quit [Quit: Linkinus - http://linkinus.com]
stardiviner has quit [Ping timeout: 260 seconds]
katlogic has quit [Ping timeout: 255 seconds]
yubrew has joined #ruby-lang
MichD is now known as michd
yubrew has quit [Ping timeout: 255 seconds]
katlogic_ has quit [Ping timeout: 240 seconds]
katlogic has joined #ruby-lang
charliesome has joined #ruby-lang
Lewix has joined #ruby-lang
stardiviner has joined #ruby-lang
snsei has joined #ruby-lang
ruby-lang616 has quit [Ping timeout: 246 seconds]
thomasxie has joined #ruby-lang
snoopybbt has quit [Ping timeout: 245 seconds]
mikecmpbll has joined #ruby-lang
duper has joined #ruby-lang
malconis has joined #ruby-lang
thomasxie has quit [Remote host closed the connection]
gix has quit [Ping timeout: 240 seconds]
malconis has quit [Client Quit]
jonathanmarvens has joined #ruby-lang
gix has joined #ruby-lang
mikecmpbll has quit [Quit: i've nodded off.]
jonathanmarvens has quit [Remote host closed the connection]
jonathanmarvens has joined #ruby-lang
diegoviola has joined #ruby-lang
jonathanmarvens has quit [Ping timeout: 240 seconds]
Metics has quit [Remote host closed the connection]
Lewix has quit [Remote host closed the connection]
snsei has quit [Remote host closed the connection]
snsei has joined #ruby-lang
ur5us has joined #ruby-lang
weems|mac has quit [Quit: weems|mac]
karamazov has joined #ruby-lang
mehlah has quit [Ping timeout: 264 seconds]
jonathanmarvens has joined #ruby-lang
thmzlt has quit []
saarinen has joined #ruby-lang
Lewix has joined #ruby-lang
snsei_ has joined #ruby-lang
snsei has quit [Ping timeout: 240 seconds]
breezy_ has quit [Remote host closed the connection]
mistym has quit [Remote host closed the connection]
ddv has quit [Ping timeout: 245 seconds]
mistym has joined #ruby-lang
mistym has quit [Remote host closed the connection]
ddv has joined #ruby-lang
enebo has quit [Quit: enebo]
shinnya has quit [Ping timeout: 244 seconds]
karamazov has quit [Remote host closed the connection]
shinnya has joined #ruby-lang
cored has joined #ruby-lang
spuk has quit [Ping timeout: 252 seconds]
spuk has joined #ruby-lang
ur5us has quit [Remote host closed the connection]
Lewix has quit [Remote host closed the connection]
breezy has joined #ruby-lang
ur5us has joined #ruby-lang
yubrew has joined #ruby-lang
yubrew has quit [Ping timeout: 240 seconds]
breezy has quit [Remote host closed the connection]
breezy has joined #ruby-lang
katlogic_ has joined #ruby-lang
saarinen has quit [Quit: saarinen]
katlogic has quit [Ping timeout: 240 seconds]
diegoviola has quit [Remote host closed the connection]
diegoviola has joined #ruby-lang
katlogic_ has quit [Ping timeout: 248 seconds]
katlogic has joined #ruby-lang
21WAALDQO has joined #ruby-lang
7F1AAOGX9 has joined #ruby-lang
stardiviner has quit [Ping timeout: 248 seconds]
7F1AAOGX9 has quit [Client Quit]
|jemc| has joined #ruby-lang
21WAALDQO has quit [Client Quit]
MikaAK has joined #ruby-lang
mistym has joined #ruby-lang
znz_jp has quit [Quit: kill -QUIT $$]
havenwood has quit [Remote host closed the connection]
znz_jp has joined #ruby-lang
|jemc| has quit [Ping timeout: 260 seconds]
red_menace has quit [Quit: peer reset by connection]
rramphal has joined #ruby-lang
breezy has quit [Remote host closed the connection]
cored has quit [Ping timeout: 272 seconds]
breezy has joined #ruby-lang
rramphal has left #ruby-lang [#ruby-lang]
zenojis has quit [Ping timeout: 240 seconds]
yubrew has joined #ruby-lang
stardiviner has joined #ruby-lang
yubrew has quit [Ping timeout: 252 seconds]
miqui_ has joined #ruby-lang
snsei has joined #ruby-lang
miqui has quit [Excess Flood]
yxhuvvd has joined #ruby-lang
pabs_ has joined #ruby-lang
yxhuvud has quit [Excess Flood]
certaint1 has joined #ruby-lang
snsei_ has quit [Write error: Connection reset by peer]
saarinen has joined #ruby-lang
twright_ has joined #ruby-lang
Miphix has joined #ruby-lang
saarinen has quit [Client Quit]
twright has quit [Write error: Broken pipe]
levifig has quit [Excess Flood]
rheddry has joined #ruby-lang
MindfulMonk has quit [Ping timeout: 877 seconds]
erichmenge has quit [Ping timeout: 877 seconds]
Sigma00 has quit [Ping timeout: 877 seconds]
erichmenge_ has joined #ruby-lang
MindfulMonk_ has joined #ruby-lang
Sigma00_ has joined #ruby-lang
mikecmpbll has joined #ruby-lang
erichmenge_ is now known as erichmenge
Sigma00_ is now known as Sigma00
MindfulMonk_ is now known as MindfulMonk
faces has joined #ruby-lang
pabs has quit [Remote host closed the connection]
certainty has quit [Remote host closed the connection]
Xney2 has joined #ruby-lang
jackyalcine has joined #ruby-lang
face has quit [Ping timeout: 276 seconds]
rsl has quit [Ping timeout: 276 seconds]
thooliha- has joined #ruby-lang
rsl has joined #ruby-lang
michael_imac has joined #ruby-lang
jacky has quit [Ping timeout: 276 seconds]
Xney has quit [Ping timeout: 276 seconds]
thooliha- is now known as thoolihan
thoolihan has quit [Ping timeout: 276 seconds]
michael_mbp has quit [Ping timeout: 276 seconds]
MikaAK has quit [Ping timeout: 255 seconds]
Lewix has joined #ruby-lang
jonathanmarvens has quit [Remote host closed the connection]
jonathanmarvens has joined #ruby-lang
tectonic has quit []
mikecmpbll has quit [Quit: i've nodded off.]
jonathanmarvens has quit [Ping timeout: 264 seconds]
jonathanmarvens has joined #ruby-lang
kyb3r_ has joined #ruby-lang
havenwood has joined #ruby-lang
rsl has quit [Read error: Connection reset by peer]
goatish_mound has joined #ruby-lang
DivineEntity has quit [Quit: leaving]
DivineEntity has joined #ruby-lang
nofxx has quit [Ping timeout: 248 seconds]
simoz1111114 has quit [Ping timeout: 260 seconds]
mistym has quit [Remote host closed the connection]
wnd has quit [Ping timeout: 248 seconds]
dm78 has joined #ruby-lang
yubrew has joined #ruby-lang
breezy has quit [Remote host closed the connection]
nofxx has joined #ruby-lang
breezy has joined #ruby-lang
yubrew has quit [Ping timeout: 244 seconds]
Caius has quit [Ping timeout: 255 seconds]
sonander has quit [Ping timeout: 255 seconds]
sonander has joined #ruby-lang
Caius has joined #ruby-lang
elikem_ has joined #ruby-lang
GarethAdams has quit [Ping timeout: 240 seconds]
elikem has joined #ruby-lang
breezy_ has joined #ruby-lang
elikem_ has quit [Quit: Lingo - http://www.lingoirc.com]
GarethAdams has joined #ruby-lang
katlogic has quit [Read error: Connection reset by peer]
breezy has quit [Ping timeout: 264 seconds]
iamcalledrob has joined #ruby-lang
katlogic has joined #ruby-lang
mikecmpbll has joined #ruby-lang
CaptainJet has quit []
dm78 has quit [Remote host closed the connection]
rheddry is now known as levifig
twright_ has quit [Ping timeout: 240 seconds]
mikecmpbll has quit [Quit: i've nodded off.]
Lewix has quit [Remote host closed the connection]
saarinen has joined #ruby-lang
saarinen has quit [Client Quit]
breezy_ has quit [Remote host closed the connection]
mistym has joined #ruby-lang
stardiviner has quit [Ping timeout: 248 seconds]
tectonic has joined #ruby-lang
Blaguvest has quit []
zenojis has joined #ruby-lang
yubrew has joined #ruby-lang
thomasxie has joined #ruby-lang
banister has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
yubrew has quit [Ping timeout: 244 seconds]
banister has joined #ruby-lang
aero224 has quit [Remote host closed the connection]
havenwood has quit [Remote host closed the connection]
gnfz has joined #ruby-lang
aero224 has joined #ruby-lang
dsferreira has quit [Read error: Connection reset by peer]
dsferreira has joined #ruby-lang
twright has joined #ruby-lang
banister has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
brahmana has joined #ruby-lang
deg- has quit [Ping timeout: 248 seconds]
deg- has joined #ruby-lang
jonathanmarvens has quit []
twright has quit [Ping timeout: 244 seconds]
iamcalledrob has quit [Quit: Lingo - http://www.lingoirc.com]
dm78 has joined #ruby-lang
dm78 has quit [Ping timeout: 272 seconds]
mikecmpbll has joined #ruby-lang
arup_r1 has joined #ruby-lang
Mon_Ouie has joined #ruby-lang
tectonic has quit []
twright has joined #ruby-lang
yubrew has joined #ruby-lang
oste has quit [Quit: oste]
theharshest has quit [Quit: This computer has gone to sleep]
iamcalledrob has joined #ruby-lang
banister has joined #ruby-lang
twright has quit [Ping timeout: 244 seconds]
mikecmpbll has quit [Quit: i've nodded off.]
tectonic has joined #ruby-lang
yubrew has quit [Ping timeout: 264 seconds]
Miphix has quit [Ping timeout: 248 seconds]
<arup_r1> Why we need to defined `#respond_to?` while defining `#method_missing` in any of our custom class ?
jperry has quit [Read error: Connection reset by peer]
jperry has joined #ruby-lang
tectonic has quit []
postmodern has quit [Quit: Leaving]
jhass|off is now known as jhass
<brahmana> arup_r1: I don't think it is stricktly required, but it makes sense to do so. With method_missing you are trying to handle to provide functionality which is not there in any of the existing defined methods.
<brahmana> If a consumer of your class is very careful and calls methods only after responds_to returns true then your method_missing will never be called.
<arup_r1> If you don't mind would you consider to give an example for the same ?
Lumio has joined #ruby-lang
banister has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
rahul_j has joined #ruby-lang
<brahmana> arup_r1: This might help : http://pastie.org/9360243
Lumio has quit [Ping timeout: 260 seconds]
<Mon_Ouie> arup_r1: You shouldn't redefine respond_to?, you should redefine respond_to_missing?
_ht has joined #ruby-lang
<Mon_Ouie> Because that's what gets checked when you call Object#method
<arup_r1> brahmana: makes sense.. create gist, so that I can bookmark it.. Now how would you implement #respons_to? so that it says `true` when the methods will be defined dynamically or will be handled by #method_missing ?
<arup_r1> Mon_Ouie: Aww.. I was not aware of... People always says me to define #respond_to? not #respond_to_missing? .. I am bit confused now..
<brahmana> arup_r1: Please read what Mon_Ouie said. He definitely knows more Ruby than me.
<Mon_Ouie> def respond_to_missing?(symbol, include_all); symbol =~ regexp || super; end
<Mon_Ouie> Where 'symbol =~ regexp' would be whatever condition you use in method_missing
<arup_r1> Mon_Ouie: Thanks for your response... Could you create a gist, to explain this all.. so that I can bookmark and play with it... This concept sucks for me :(
<brahmana> arup_r1: You can create a gist of anything you want yourself, isn't it?
<arup_r1> Humm.. But still not clear to me .. how this 2 works together in one place.. so I am thinking if I see a code till the point, it
rippa has joined #ruby-lang
aero224 has quit [Remote host closed the connection]
<arup_r1> is paining.. I can take it forward from there on..
dangerousdave has joined #ruby-lang
<Mon_Ouie> Should include most problems you can encounter with not redefining it
Lumio has joined #ruby-lang
<arup_r1> Mon_Ouie: Thank you very much... Please don't delete this gist ever.. as it is very helpful.. :-)
dangerousdave has quit [Read error: Connection reset by peer]
dangerousdave has joined #ruby-lang
Atttwww has quit [Ping timeout: 240 seconds]
dm78 has joined #ruby-lang
mikecmpbll has joined #ruby-lang
arkneca has joined #ruby-lang
rahul_j has quit [Quit: rahul_j]
Miphix has joined #ruby-lang
dm78 has quit [Ping timeout: 248 seconds]
<arup_r1> Mon_Ouie: Now I understood the construct now.. How `#respond_to?` and `#respond_to_missing?` talks between each other ?
<Mon_Ouie> respond_to? first checks methods that are really defined. If it doesn't find it, it calls respond_to_missing? and returns that
<Mon_Ouie> ('really' as in not through method missing)
brahmana has quit [Quit: Page closed]
Caius has quit [Ping timeout: 255 seconds]
yubrew has joined #ruby-lang
Caius has joined #ruby-lang
zenojis has quit [Ping timeout: 240 seconds]
twright has joined #ruby-lang
yubrew has quit [Ping timeout: 260 seconds]
mistym_ has joined #ruby-lang
zenojis has joined #ruby-lang
relix has joined #ruby-lang
mistym has quit [Ping timeout: 240 seconds]
iamcalledrob has quit [Quit: Computer has gone to sleep.]
twright has quit [Ping timeout: 244 seconds]
iamcalledrob has joined #ruby-lang
Derander has quit [Ping timeout: 240 seconds]
<arup_r1> Mon_Ouie: Got it... If final decision is taken by #respond_to_missing?, why we need #respond_to? ?
<jhass> arup_r1: respond_to_missing? doesn't know if the regular method exists
<jhass> >> [[].respond_to?(:join),[].respond_to_missing?(:join)]
<eval-in_> jhass => private method `respond_to_missing?' called for []:Array (NoMethodError) ... (https://eval.in/169802)
<jhass> meh
<jhass> >> [[].respond_to?(:join),[].send(:respond_to_missing?, :join)]
<eval-in_> jhass => wrong number of arguments (1 for 2) (ArgumentError) ... (https://eval.in/169803)
Derander has joined #ruby-lang
<jhass> I should try that beforehand...
<Mon_Ouie> Second argument should be a boolean, e.g. true
<jhass> >> [[].respond_to?(:join),[].send(:respond_to_missing?, :join, true)]
<eval-in_> jhass => [true, false] (https://eval.in/169804)
iamcalledrob has quit [Ping timeout: 264 seconds]
dm78 has joined #ruby-lang
arkneca has quit [Quit: Leaving]
<arup_r1> @jhass thanks.. what do you mean by *regular* methods ?
<Mon_Ouie> Those that aren't defined by method_missing, simply using def, etc.
banister has joined #ruby-lang
dm78 has quit [Ping timeout: 255 seconds]
banister has quit [Client Quit]
banister has joined #ruby-lang
banister has quit [Client Quit]
dangerou_ has joined #ruby-lang
<arup_r1> What *boolean* value does there with #respond_to_missing. As I didn't get that information from doco http://ruby-doc.org/core-2.1.2/Object.html#method-i-respond_to_missing-3F
banister has joined #ruby-lang
breezy has joined #ruby-lang
<jhass> arup_r1: that's just the flag with the same name from respond_to? passed through
dangerousdave has quit [Ping timeout: 248 seconds]
mistym_ is now known as mistym
x0f has quit [Ping timeout: 260 seconds]
x0f has joined #ruby-lang
<arup_r1> Thanks to all.. A very sweet learning for me... :-)
theharshest has joined #ruby-lang
theharshest has quit [Client Quit]
iamcalledrob has joined #ruby-lang
<arup_r1> Ahh.. I am creating gist for my future ref.. But something is going wrong https://gist.github.com/aruprakshit/b205806a81c592988025 why I am not getting [false, true] ?
iamcalledrob has quit [Ping timeout: 248 seconds]
<arup_r1> I did a mess.. sorry let me fix this first
<jhass> "#{foo}" -> foo.to_s
dangerousdave has joined #ruby-lang
<jhass> and your issue is that your parameter is called m, so "#{meth}" calls the method and evaluates to "12"
<apeiros> meth? OMG! Don't do drugs!
<arup_r1> haha updated https://gist.github.com/aruprakshit/b205806a81c592988025 .. But why not [false, true] ? :-(
dangerou_ has quit [Ping timeout: 248 seconds]
<Mon_Ouie> Because respond_to_missing?(:baz, true) is true
<Mon_Ouie> And respond_to? calls respond_to_missing?
<arup_r1> Just someone said.. respond_to? returns true for regular method... but :baz is not regular..
breezy has quit [Remote host closed the connection]
<Mon_Ouie> It returns true for regular methods, then, if it didn't find that method, it calls respond_to_missing?
breezy has joined #ruby-lang
yubrew has joined #ruby-lang
ur5us has quit [Read error: Connection reset by peer]
ur5us has joined #ruby-lang
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
breezy has quit [Ping timeout: 240 seconds]
yubrew has quit [Ping timeout: 248 seconds]
rahul_j has joined #ruby-lang
twright has joined #ruby-lang
diegoviola has quit [Quit: WeeChat 0.4.3]
<arup_r1> Yes.. That's I am wondering.. I didn't define #baz... so #respond_to? should return false...
twright has quit [Ping timeout: 244 seconds]
duper has quit [Ping timeout: 260 seconds]
<Mon_Ouie> No, because it's calling respond_to_missing? which returns true
duper has joined #ruby-lang
<Mon_Ouie> respond_to? does something like methods.include?(name) ? true : respond_to_missing?(name, include_all)
dm78 has joined #ruby-lang
<apeiros> singleton_class.method_defined?(name) || respond_to_missing?(name, include_all)
dm78 has quit [Ping timeout: 248 seconds]
Lumio has quit [Quit: Lumio]
duper has quit [Ping timeout: 252 seconds]
mistym has quit [Remote host closed the connection]
<arup_r1> Mon_Ouie: Got it.. Thanks
schaerli has joined #ruby-lang
<Mon_Ouie> apeiros: Plus including private methods if include_all is true :)
iamcalledrob has joined #ruby-lang
bin7me has joined #ruby-lang
iamcalledrob has quit [Ping timeout: 252 seconds]
yubrew has joined #ruby-lang
Missphoenix has joined #ruby-lang
<arup_r1> Mon_Ouie: In summary. what I understand is - if `respond_to?` is returns `true`, then `#respond_to_missing?` will not be called. But if `respond_to?` returns false, then `#respond_to_missing?` will be called, and if it returns true, then `#respond_to?` also will return true. Is my understanding correct ?
<jhass> yes
<Mon_Ouie> It's not if respond_to? returns true/false. It's if the first check inside respond_to? is true/false.
Miphix has quit [Ping timeout: 255 seconds]
zUriel_ has joined #ruby-lang
yubrew has quit [Ping timeout: 255 seconds]
<Mon_Ouie> (You said 'if respond_to? returns false and respond_to_missing? returns true then respond_to? returns true', which is contradictory)
<arup_r1> Ohh... God give me some gray matter ........... :-(
marr has joined #ruby-lang
* Mon_Ouie gives arup_r1 a rock
<arup_r1> Ok. first check is respond_to? , if it returns false, then respond_to_missing? will be called ... Is it correct understanding ?
<Mon_Ouie> Yes. That first check being, 'has the method been defined through normal means?'
<arup_r1> ok....
<arup_r1> Now hold on
<arup_r1> Now first check is #respond_to?... it returns false. check goes to #respond_to_missing? ........... if now this method returns true, then what will be the output of `#respond_to?` ?
<Mon_Ouie> true
<arup_r1> Ok.. let me lock it first inside my brain.. otherwise I will become again dumb.. :-)
drbrain has quit [Ping timeout: 248 seconds]
stardiviner has joined #ruby-lang
drbrain has joined #ruby-lang
twright has joined #ruby-lang
Lewix has joined #ruby-lang
thomasxie has quit [Read error: Connection reset by peer]
twright has quit [Ping timeout: 244 seconds]
kyb3r_ has quit [Read error: Connection reset by peer]
red_menace has joined #ruby-lang
relix has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
dm78 has joined #ruby-lang
VTLob has joined #ruby-lang
<arup_r1> As per the doc Enumerable#to_a receives argument.. http://ruby-doc.org/core-2.1.2/Enumerable.html#method-i-to_a . But if I try (1..5).to_a(2) # ArgumentError: wrong number of arguments (1 for 0)
<arup_r1> Why then doco is showing there #to_a receives argument ?
dm78 has quit [Ping timeout: 264 seconds]
kirin` has joined #ruby-lang
<Mon_Ouie> It's probably just a case of RDoc not being smart enough to understand it
<jhass> >> class Foo; def each(a, b, c); yield c; yield b; yield a; end; end; Enumerator.new(Foo.new).to_a(1, 2, 3) # that one maybe?
certaint1 is now known as certainty
schaerli has quit [Remote host closed the connection]
ur5us has quit [Remote host closed the connection]
red_menace has quit [Ping timeout: 260 seconds]
Lewix has quit [Remote host closed the connection]
red_menace has joined #ruby-lang
yubrew has joined #ruby-lang
iamcalledrob has joined #ruby-lang
tbuehlmann has joined #ruby-lang
schaerli has joined #ruby-lang
yubrew has quit [Ping timeout: 240 seconds]
iamcalledrob has quit [Ping timeout: 240 seconds]
stamina has joined #ruby-lang
schaerli has quit [Remote host closed the connection]
Caius has quit [Ping timeout: 255 seconds]
yfeldblum has joined #ruby-lang
Caius has joined #ruby-lang
danijoo has joined #ruby-lang
<arup_r1> jhass: don't know it is confusing to me..
<jhass> I think it passes the args to each
twright has joined #ruby-lang
<apeiros> arup_r1: *args does not mean *1* argument, it means *any number* of arguments
dangerousdave has quit [Read error: Connection reset by peer]
<apeiros> and that's correct, but depends on the underlying .each method
wnd has joined #ruby-lang
dangerousdave has joined #ruby-lang
<apeiros> jhass: no need for Enumerator there. just include Enumerable.
<apeiros> >> class Foo; include Enumerable; def each(a, b, c); yield c; yield b; yield a; end; end; Foo.new.to_a(1, 2, 3)
<eval-in_> apeiros => [3, 2, 1] (https://eval.in/169818)
<apeiros> oh, eval-in_ woke up
<yxhuvvd> >> sleep 10; 'hi'
<eval-in_> yxhuvvd => (https://eval.in/169819)
<Mon_Ouie> eval-in_: Please tell me about your work schedule
toretore has joined #ruby-lang
twright has quit [Ping timeout: 244 seconds]
<arup_r1> apeiros: you are right.. I gave it as an example.
<apeiros> arup_r1: hm? you gave what as example?
yfeldblu_ has joined #ruby-lang
yfeldblum has quit [Ping timeout: 244 seconds]
<arup_r1> apeiros: (1..5).to_a(2) # only one argument :-)
<apeiros> you also said "As per the doc Enumerable#to_a receives argument"
<apeiros> I read that as "one argument", otherwise should be "receives arguments". plural ;-)
<apeiros> anyway. Enumerable#to_a passing arguments on to #each is the reason why (1..5).to_a(2) raises. (1..5).each does not accept arguments
<arup_r1> thanks for correcting my grammar.. English is too tough than Ruby for me.. Not native speaker.. :-)
<arup_r1> Yes I know.. But then why that a API ?
stamina has quit [Quit: WeeChat 0.4.3]
<jhass> so that if you each needs an argument you can pass it along
<jhass> *your each
dm78 has joined #ruby-lang
<apeiros> arup_r1: as shown by jhass' and my example
dm78 has quit [Ping timeout: 260 seconds]
arup_r1 has quit [Read error: Connection reset by peer]
arup_r has joined #ruby-lang
<arup_r> Let me see ..
yubrew has joined #ruby-lang
yubrew has quit [Ping timeout: 252 seconds]
iamcalledrob has joined #ruby-lang
yfeldblu_ has quit [Remote host closed the connection]
iamcalledrob has quit [Ping timeout: 255 seconds]
rahul_j has joined #ruby-lang
yfeldblum has joined #ruby-lang
schaerli has joined #ruby-lang
schaerli has quit [Remote host closed the connection]
earthquake has quit [Quit: earthquake]
dangerousdave has quit [Read error: Connection reset by peer]
dangerou_ has joined #ruby-lang
yfeldblum has quit [Read error: Connection reset by peer]
MindfulMonk has quit [Read error: Connection timed out]
<arup_r> Yes.. I got this also.. Thanks again to you all :-)
MindfulMonk has joined #ruby-lang
twright has joined #ruby-lang
MindfulMonk has quit [Max SendQ exceeded]
MindfulMonk has joined #ruby-lang
MindfulMonk has quit [Max SendQ exceeded]
MindfulMonk has joined #ruby-lang
MindfulMonk has quit [Max SendQ exceeded]
MindfulMonk has joined #ruby-lang
nofxx has quit [Ping timeout: 255 seconds]
MindfulMonk has quit [Max SendQ exceeded]
MindfulMonk has joined #ruby-lang
twright has quit [Ping timeout: 244 seconds]
cored has joined #ruby-lang
cored has joined #ruby-lang
cored has quit [Changing host]
MindfulMonk has quit [Max SendQ exceeded]
MindfulMonk has joined #ruby-lang
symm- has joined #ruby-lang
dm78 has joined #ruby-lang
thomasxie has joined #ruby-lang
dm78 has quit [Ping timeout: 248 seconds]
schlubbi_ has joined #ruby-lang
schlubbi_ has quit [Client Quit]
lolmaus has quit [Remote host closed the connection]
yubrew has joined #ruby-lang
thomasxie has quit [Quit: Leaving.]
yubrew has quit [Ping timeout: 264 seconds]
twright has joined #ruby-lang
stamina has joined #ruby-lang
sarkyniin has joined #ruby-lang
klaNath_ has quit [Ping timeout: 248 seconds]
iamcalledrob has joined #ruby-lang
tbuehlmann has quit [Remote host closed the connection]
twright has quit [Ping timeout: 244 seconds]
weems|mac has joined #ruby-lang
iamcalledrob has quit [Ping timeout: 244 seconds]
banister has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
banister has joined #ruby-lang
<arup_r> Is the same reasons holds for Enumerable#to_h (http://ruby-doc.org/core-2.1.2/Enumerable.html#method-i-to_h) .. It also accepts arguments...
<jhass> yes
<arup_r> ok
<arup_r> Range is an Enumerable right ?
<jhass> yes
<jhass> >> (1..3).is_a? Enumerable
<eval-in_> jhass => true (https://eval.in/169825)
<arup_r> Ok.. Now why then Range#to_h is not valid (1..2).to_h # TypeError: wrong element type Fixnum (expected array)
<arup_r> I meant to say... #to_h then can be put in the Array api
<arup_r> what is the need to put it in the Enumerable API, while some Enumerable like Range doesn't support #to_h
Cakey has joined #ruby-lang
snoopybbt has joined #ruby-lang
<jhass> The benefit is that you can make your own classes that do support the #to_h API and don't have to write it on your own
<arup_r> But the error message is saying explicitly that it needs Array to move further.. :-)
banister has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
twright has joined #ruby-lang
<jhass> >> class Foo; include Enumerable; def each; yield [1, 2]; yield [3, 4]; end; Foo.new.to_h
<eval-in_> jhass => /tmp/execpad-35c82aa2df7c/source-35c82aa2df7c:7: syntax error, unexpected end-of-input, expecting keyword_end (https://eval.in/169826)
<jhass> >> class Foo; include Enumerable; def each; yield [1, 2]; yield [3, 4]; end; end; Foo.new.to_h
<eval-in_> jhass => {1=>2, 3=>4} (https://eval.in/169827)
weems|mac has quit [Quit: weems|mac]
twright has quit [Ping timeout: 240 seconds]
<arup_r> Can you explain how this code is working.. Yield is working inside each.. ?
apeiros has quit []
<arup_r> It is interesting...
dm78 has joined #ruby-lang
yubrew has joined #ruby-lang
<jhass> do you understand blocks yet?
<jhass> and defining methods that take blocks?
dm78 has quit [Ping timeout: 252 seconds]
<arup_r> Yes.. I know..
Cakey has quit [Ping timeout: 255 seconds]
klaNath has joined #ruby-lang
<jhass> So, all Enumerable does is calling that method and doing stuff with the parameters
<arup_r> But when call #to_h .. it is calling #each and then inside #each you are yielding the value... But to which block you are supplying it.. ?
marr has quit []
<jhass> for example a simplified Enumerable#to_a can be: def to_a; a = []; each do |elem| a << elem; end; a; end
<jhass> then you can build a to_h from that by simply doing def to_h; Hash[*to_a]; end
twright has joined #ruby-lang
yubrew has quit [Ping timeout: 252 seconds]
<jhass> that's basically what Enumerable is doing, passing predefined blocks to each and composing greater functionality from that
twright has quit [Read error: Connection reset by peer]
zUriel_ has quit [Remote host closed the connection]
snsei has quit [Remote host closed the connection]
twright has joined #ruby-lang
<arup_r> Very cool explanation... +1 .. Then Range#to_h also should work right ?
<bougyman> in mri, yes.
<bougyman> mri 2+, iirc.
<bougyman> 1.9.3 doesn't like it
<bougyman> nor does rubinius
<rau> bougyman: Please stop abusing your return key, you hideous asshole.
snoopybbt has quit [Ping timeout: 245 seconds]
<bougyman> happy sunday to you, too, rau.
rahul_j has quit [Quit: rahul_j]
<arup_r> rau: can you shut up please.. ? in #RubyOnRails you are shouting the same way...
Lewix has joined #ruby-lang
<arup_r> bougyman: I can see Foo.new.to_h is not working ... :p "Yes" means what BTW :-)
<arup_r> Ok... got it ..You mean the Ruby version..
MindfulMonk has quit [Ping timeout: 272 seconds]
<arup_r> jhass: Why then Range#to_h doesn't work ?
MindfulMonk has joined #ruby-lang
<jhass> because #to_h expects two element arrays to be yielded, range yields numbers
MindfulMonk is now known as MindfulMo
centrx has joined #ruby-lang
<arup_r> Ahh... Cool...
<arup_r> jhass: which book you follow ? :-)
<jhass> none
iamcalledrob has joined #ruby-lang
<arup_r> Hahaha .. awesome..
snoopybbt has joined #ruby-lang
iamcalledrob has quit [Ping timeout: 260 seconds]
stardiviner has quit [Ping timeout: 255 seconds]
weems|mac has joined #ruby-lang
dangerou_ has quit [Read error: Connection reset by peer]
dangerousdave has joined #ruby-lang
jackyalcine is now known as jacky
luiz_ has joined #ruby-lang
luiz_ is now known as Guest63955
snoopybbt has quit [Ping timeout: 245 seconds]
Guest81641 has quit [Ping timeout: 252 seconds]
dangerousdave has quit [Read error: Connection reset by peer]
karamazov has joined #ruby-lang
dangerousdave has joined #ruby-lang
arBmind1 has joined #ruby-lang
arBmind has quit [Ping timeout: 248 seconds]
symm- has quit [Ping timeout: 264 seconds]
klaNath has quit [Ping timeout: 260 seconds]
thomasxie has joined #ruby-lang
KM has joined #ruby-lang
KM is now known as Guest2391
klaNath has joined #ruby-lang
brianpWins_ has joined #ruby-lang
stamina has quit [Ping timeout: 255 seconds]
wnd_ has joined #ruby-lang
rsl has joined #ruby-lang
Hightower_ has joined #ruby-lang
yubrew has joined #ruby-lang
gix- has joined #ruby-lang
gix has quit [Disconnected by services]
yeltzooo4 has joined #ruby-lang
dm78 has joined #ruby-lang
charliesome has joined #ruby-lang
Jam_ has joined #ruby-lang
Guest63955 has quit [*.net *.split]
wnd has quit [*.net *.split]
VTLob has quit [*.net *.split]
goatish_mound has quit [*.net *.split]
brianpWins has quit [*.net *.split]
ecnalyr has quit [*.net *.split]
yeltzooo has quit [*.net *.split]
Guest80708 has quit [*.net *.split]
Hightower666 has quit [*.net *.split]
dabradley has quit [*.net *.split]
jtperreault has quit [*.net *.split]
aarellano has quit [*.net *.split]
brianpWins_ is now known as brianpWins
yubrew has quit [Ping timeout: 248 seconds]
wnd_ is now known as wnd
dm78 has quit [Ping timeout: 272 seconds]
Guest63955 has joined #ruby-lang
jtperreault has joined #ruby-lang
dabradley has joined #ruby-lang
snsei has joined #ruby-lang
dangerou_ has joined #ruby-lang
kalehv has joined #ruby-lang
VTLob has joined #ruby-lang
dangerousdave has quit [Ping timeout: 248 seconds]
Mon_Ouie has quit [Ping timeout: 240 seconds]
snsei has quit [Remote host closed the connection]
Phoenixmiss has joined #ruby-lang
schaerli has joined #ruby-lang
rahul_j has joined #ruby-lang
Jam_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
snsei has joined #ruby-lang
schaerli has quit [Remote host closed the connection]
iamcalledrob has joined #ruby-lang
klaNath has quit [Ping timeout: 240 seconds]
Missphoenix has quit [Ping timeout: 272 seconds]
Jam_ has joined #ruby-lang
cored has quit [Ping timeout: 252 seconds]
iamcalledrob has quit [Ping timeout: 272 seconds]
Mon_Ouie has joined #ruby-lang
klaNath has joined #ruby-lang
Lewix has quit [Remote host closed the connection]
rahul_j has quit [Quit: rahul_j]
Lewix has joined #ruby-lang
sheperson has joined #ruby-lang
<arup_r> Is there any difference Between Array#take and Array#first ?
<arup_r> I never have seen, in my work..
kalehv has quit []
<epitron> #take is for enumerators
<epitron> >> [1,2,3,4].lazy.take 3
<eval-in_> epitron => #<Enumerator::Lazy: #<Enumerator::Lazy: [1, 2, 3, 4]>:take(3)> (https://eval.in/169838)
<epitron> >> [1,2,3,4].lazy.first 3
<eval-in_> epitron => [1, 2, 3] (https://eval.in/169839)
<epitron> also, #take always needs a param, while #first doesn't
<arup_r> [].method(:take).owner # => Array
<arup_r> I meant to say, why then #take is needed to redefine for Array ?
<epitron> performance probably
<epitron> instead of copying the array, you can just point to a subset of it
cored has joined #ruby-lang
<arup_r> Array#first also take arguments [1,2,3,4].first(2) # => [1, 2]
dm78 has joined #ruby-lang
devgiant has joined #ruby-lang
karamazov has quit [Remote host closed the connection]
rahul_j has joined #ruby-lang
Jam_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
ecnalyr has joined #ruby-lang
aarellano has joined #ruby-lang
robbyoconnor has quit [Remote host closed the connection]
javilm has joined #ruby-lang
scmx has joined #ruby-lang
robbyoconnor has joined #ruby-lang
r0bby has joined #ruby-lang
r0bby has quit [Read error: Connection reset by peer]
robbyoconnor has quit [Read error: Connection reset by peer]
robbyoconnor has joined #ruby-lang
klaNath has quit [Ping timeout: 240 seconds]
Caius has quit [Ping timeout: 255 seconds]
r0bby has joined #ruby-lang
robbyoconnor has quit [Remote host closed the connection]
sheperson has quit [Quit: sheperson]
r0bby is now known as robbyoconnor
klaNath has joined #ruby-lang
CaptainJet has joined #ruby-lang
r0bby has joined #ruby-lang
r0bby has quit [Remote host closed the connection]
Ca1us has joined #ruby-lang
karamazov has joined #ruby-lang
rahul_j has quit [Quit: rahul_j]
karamazov has quit [Remote host closed the connection]
Lewix has quit [Remote host closed the connection]
devgiant_ has joined #ruby-lang
nathanstitt has joined #ruby-lang
Lewix has joined #ruby-lang
relix has joined #ruby-lang
iamcalledrob has joined #ruby-lang
devgiant has quit [Ping timeout: 272 seconds]
Jam has joined #ruby-lang
devgiant has joined #ruby-lang
Jam is now known as Guest27760
theharshest has joined #ruby-lang
sk_0 has joined #ruby-lang
theharshest has quit [Client Quit]
devgiant_ has quit [Ping timeout: 264 seconds]
centrx has quit [Quit: Mission accomplished. Ready for self-termination.]
iamcalledrob has quit [Ping timeout: 248 seconds]
scmx has quit [Ping timeout: 240 seconds]
weems|mac has quit [Quit: weems|mac]
jsullivandigs has quit [Remote host closed the connection]
theharshest has joined #ruby-lang
pskosinski has joined #ruby-lang
iamcalledrob has joined #ruby-lang
earthquake has joined #ruby-lang
theharshest has quit [Quit: This computer has gone to sleep]
yubrew has joined #ruby-lang
dangerou_ has quit [Read error: Connection reset by peer]
<arup_r> Do anyone use here Rspec ?
dangerousdave has joined #ruby-lang
sonander has quit [Ping timeout: 260 seconds]
<jhass> arup_r: just ask your question and you'll find out
<arup_r> Can anyone give me some idea about when to use *shared_context* and when *shared_example* ?
yubrew has quit [Ping timeout: 260 seconds]
elikem has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
theharshest has joined #ruby-lang
nathanstitt has quit [Quit: I growing sleepy]
rahul_j has joined #ruby-lang
<jhass> it looks like shared_context should be used when you have no examples, just auxiliary stuff (let, before, def, ...)
<jhass> that said, I've never saw that used
DivineEntity has quit [Quit: leaving]
DivineEntity has joined #ruby-lang
<arup_r> jhass: Could you give some brief idea about what is the diff between context and example ?
<arup_r> Yes.. shared example is cleared... but *shared_context* not much...
<jhass> as I understood it, while technically similar, they're basically opposing features. shared_context provides a common context for different examples, while shared_examples provides common examples for different contexts
ruby-lang648 has joined #ruby-lang
<arup_r> ahh.. I will think about your this sentence,,,
Guest27760 has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<arup_r> It has answer I think..
ruby-lang648 has quit [Client Quit]
thomasxie has quit [Ping timeout: 240 seconds]
rubyaw has joined #ruby-lang
bin7me has quit [Remote host closed the connection]
dangerou_ has joined #ruby-lang
sonander has joined #ruby-lang
dangerousdave has quit [Ping timeout: 248 seconds]
dangerou_ has quit [Read error: Connection reset by peer]
dangerousdave has joined #ruby-lang
theharshest has quit [Quit: This computer has gone to sleep]
oste has joined #ruby-lang
theharshest has joined #ruby-lang
theharshest has quit [Client Quit]
iamcalledrob has quit [Quit: Computer has gone to sleep.]
Phoenixmiss has quit [Quit: Leaving]
havenwood has joined #ruby-lang
iamcalledrob has joined #ruby-lang
theharshest has joined #ruby-lang
iamcalledrob has quit [Ping timeout: 272 seconds]
AKASkip has joined #ruby-lang
nathanstitt has joined #ruby-lang
x0f has quit [Ping timeout: 260 seconds]
x0f has joined #ruby-lang
theharshest has quit [Quit: This computer has gone to sleep]
yubrew has joined #ruby-lang
pskosinski has quit [Quit: Til rivido Idisti! | http://www.ido.li]
snoopybbt has joined #ruby-lang
yubrew has quit [Ping timeout: 240 seconds]
snoopybbt has quit [Remote host closed the connection]
snoopybbt has joined #ruby-lang
Xzyx987X has joined #ruby-lang
relix has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
dm78 has quit [Remote host closed the connection]
Xzyx987X_ has quit [Ping timeout: 272 seconds]
relix has joined #ruby-lang
snoopybbt has quit [Remote host closed the connection]
iamcalledrob has joined #ruby-lang
Lumio has joined #ruby-lang
mehlah has joined #ruby-lang
mehlah has quit [Client Quit]
dangerousdave has quit [Read error: Connection reset by peer]
dangerousdave has joined #ruby-lang
relix has quit [Ping timeout: 252 seconds]
iamcalledrob has quit [Ping timeout: 264 seconds]
Lewix has quit [Remote host closed the connection]
weems|mac has joined #ruby-lang
rahul_j has quit [Quit: rahul_j]
rahul_j has joined #ruby-lang
havenwood has quit [Remote host closed the connection]
rahul_j has quit [Client Quit]
schaerli has joined #ruby-lang
relix has joined #ruby-lang
havenwood has joined #ruby-lang
sarkyniin has quit [Ping timeout: 272 seconds]
relix has quit [Ping timeout: 264 seconds]
sarkyniin has joined #ruby-lang
dangerou_ has joined #ruby-lang
dangerousdave has quit [Read error: Connection reset by peer]
touzin has joined #ruby-lang
postmodern has joined #ruby-lang
mistym has joined #ruby-lang
<arup_r> I never read Fiber http://ruby-doc.org/core-2.1.2/Fiber.html . I will start it straight from the doco.. Before starting it if I can get a backgorund of the area of application of this concept, it will be helpful for me to read keeping those facts inside mine, so that I can relate ...... Can anyone give a brief intro on it ?
MindfulMo is now known as MindfulMonk
<jhass> I yet have to see fibers used in production code
mconnolly has joined #ruby-lang
mconnolly has quit [Client Quit]
nathanstitt has quit [Quit: I growing sleepy]
yubrew has joined #ruby-lang
Lewix has joined #ruby-lang
<arup_r> jhass: I never have seen any code on this.. But I am interested to know this topic too...
yubrew has quit [Ping timeout: 252 seconds]
nathanstitt has joined #ruby-lang
theharshest has joined #ruby-lang
marr has joined #ruby-lang
<arup_r> havenwood: Does Fiber and Thread same concept ?
rippa has quit [Ping timeout: 252 seconds]
<havenwood> arup_r: Similar in some ways but not the same. Take a look at Celluloid's TaskThread for comparison to the TaskFiber above: https://github.com/celluloid/celluloid/blob/master/lib/celluloid/tasks/task_thread.rb
rippa has joined #ruby-lang
thmzlt has joined #ruby-lang
<arup_r> havenwood: I gave it a look, went above my head ........... :(
<havenwood> arup_r: My fault, bad example.
iamcalledrob has joined #ruby-lang
simoz1111114 has joined #ruby-lang
simoz1111115 has joined #ruby-lang
dangerou_ has quit [Read error: Connection reset by peer]
dangerousdave has joined #ruby-lang
iamcalledrob has quit [Ping timeout: 240 seconds]
<havenwood> arup_r: Fibers spawn faster with less memory but they come with their own drawbacks.
simoz1111114 has quit [Ping timeout: 248 seconds]
<havenwood> arup_r: Might be worth looking at a little bit higher layer abstractions for concurrency in Ruby. The `concurrent-ruby` gem has some great examples of stuff like agents, actors, futures, etc: https://github.com/ruby-concurrency/concurrent-ruby#readme
theharshest has quit [Quit: This computer has gone to sleep]
theharshest has joined #ruby-lang
<havenwood> arup_r: Or practical uses of Threads/Fibers with Celluloid, Celluloid::IO and friends.
theharshest has quit [Client Quit]
apeiros has joined #ruby-lang
<arup_r> havenwood: thanks,, I will try to understand those..
<havenwood> arup_r: A bit of good reading of Fibers: https://www.igvita.com/2009/05/13/fibers-cooperative-scheduling-in-ruby/
<toretore> arup_r: fibers are like threads except they are not preempted
<havenwood> s/of/on
<toretore> they have to yield explicitly from the inside
<arup_r> toretore: could you create gist example regarding what you said ?
breezy_ has joined #ruby-lang
<arup_r> havenwood: thanks for those links...
<toretore> arup_r: it's really not something that is easily summed up
<toretore> it takes time to grok
<toretore> it's easily explained but hard to understand
theharshest has joined #ruby-lang
theharshest has quit [Client Quit]
breezy_ has quit [Remote host closed the connection]
<havenwood> arup_r: So here's an example FizzBuzz: https://gist.github.com/havenwood/113c61b9540728d4932f
breezy_ has joined #ruby-lang
<havenwood> arup_r: ^ 100 Fibers in an Array. This is a terrible example. >.>
<havenwood> Since they only yield once.
<havenwood> arup_r: Anyways, suffice it to say you schedule them, they can resume from one another back and forth. Multiple yields. Just play with them and you'll get a feel for it.
brianpWins has quit [Quit: brianpWins]
|jemc| has joined #ruby-lang
relix has joined #ruby-lang
<arup_r> havenwood: I bookmarked it... Please don't delete the gist.... :-) I will go from there... If any issue I will let you know..''
<arup_r> If any more example comes into your mind.. just throw them to me.. Let me get some pain.. :-)
thmzlt has quit []
yubrew has joined #ruby-lang
sharpmachine has joined #ruby-lang
<apeiros> arup_r: just fork the gist then
yubrew has quit [Ping timeout: 260 seconds]
nathanstitt has quit [Quit: I growing sleepy]
<arup_r> apeiros: What is the help of it ?
twright has quit [Ping timeout: 240 seconds]
<apeiros> arup_r: if you fork it, the fork is yours. nobody but you can delete it.
<arup_r> Ohhh :-p good idea.
nathanstitt has joined #ruby-lang
ledestin has quit [Ping timeout: 248 seconds]
scmx has joined #ruby-lang
ledestin has joined #ruby-lang
<arup_r> apeiros: Done.. I was not aware of it... Thanks
<havenwood> arup_r: updated gist with a fibonacci sequence fiber
<havenwood> hem, what are other trivial things to implement with Fibers that don't make sense? :P
<arup_r> havenwood: I learned some times back a new thing *fork* . Let me do it again..
hackeron_ is now known as hackeron
hackeron has quit [Changing host]
hackeron has joined #ruby-lang
theharshest has joined #ruby-lang
<arup_r> If any more example comes to your mind, just add it.. these are really good exercise for the newbies like me.. :-)
<arup_r> Guys... If you have any idea, a short code which can be implemented using Fiber.. just give me that to help me on this topic..
theharshest has quit [Client Quit]
<havenwood> arup_r: Just heading out the door but I'll try to add a more realistic example later.
<arup_r> havenwood: How would you notify me ?
theharshest has joined #ruby-lang
<havenwood> hem, i dunno if you can watch a gist? follow me on githubs? gotta run! later
<arup_r> I am here for next 30 mins... Its too late in India
<arup_r> Ok
havenwood has quit []
<arup_r> Yes.. I forked your gist, so I have the link of the original gits.. I can see it later too.. no issue
snoopybbt has joined #ruby-lang
<arup_r> Do anyone have any more idea as an example using Fiber ?
iamcalledrob has joined #ruby-lang
nofxx has joined #ruby-lang
iamcalledrob has quit [Ping timeout: 248 seconds]
theharshest has quit [Quit: This computer has gone to sleep]
breezy_ has quit [Remote host closed the connection]
aero224 has joined #ruby-lang
breezy_ has joined #ruby-lang
sonander has quit [Ping timeout: 240 seconds]
scmx has quit [Ping timeout: 272 seconds]
schaerli has quit [Remote host closed the connection]
schaerli has joined #ruby-lang
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
yubrew has joined #ruby-lang
<arup_r> In Rspec what is the difference between allow_any_instance_of and expect_any_instance_of ?
<jhass> expect raises if the call doesn't happen
nathanstitt has quit [Quit: I growing sleepy]
vintik has joined #ruby-lang
rau has quit [K-Lined]
nathanstitt has joined #ruby-lang
yubrew has quit [Ping timeout: 264 seconds]
lolmaus has joined #ruby-lang
karamazov has joined #ruby-lang
amerine has joined #ruby-lang
symm- has joined #ruby-lang
dangerousdave has quit [Read error: Connection reset by peer]
<arup_r> jhass: allow ?
<jhass> doesn't
sdouglas has joined #ruby-lang
dangerousdave has joined #ruby-lang
snoopybbt has quit [Quit: leaving]
snoopybbt has joined #ruby-lang
<arup_r> jhass: Cool ... exactly like that.. Just tested
<arup_r> Any more difference ?
sonander has joined #ruby-lang
sdouglas has quit [Remote host closed the connection]
sdouglas has joined #ruby-lang
cored has quit [Ping timeout: 264 seconds]
<arup_r> jhass: would you tell me. when people think of to use allow_* and when the expect_* ?
<jhass> allow is for when you pass doubles into the code you test and expect is for when you expect your code to make a specific call on that double
<jhass> same holds true for a external dependency you stub out
<arup_r> allow one is confusing to me
sdouglas has quit [Ping timeout: 272 seconds]
<toretore> arup_r: https://gist.github.com/toretore/32e0a7d2f904a9fd340f - concurrent io with fibers
<arup_r> toretore: Thank you very much. Could you put some #comments regarding the code.. to understand what it is doing... if possible ?
dangerousdave has quit [Read error: Connection reset by peer]
dangerousdave has joined #ruby-lang
snoopybbt has quit [Ping timeout: 245 seconds]
sdouglas has joined #ruby-lang
iamcalledrob has joined #ruby-lang
sdouglas has quit [Remote host closed the connection]
rubyaw has quit [Quit: Leaving...]
Guest2391 has quit [Read error: No route to host]
iamcalledrob has quit [Ping timeout: 264 seconds]
arup_r has quit [Ping timeout: 240 seconds]
_ht has quit [Remote host closed the connection]
yubrew has joined #ruby-lang
dsferreira has quit [Quit: This computer has gone to sleep]
yubrew has quit [Ping timeout: 272 seconds]
havenwood has joined #ruby-lang
dsferreira has joined #ruby-lang
nathanstitt has quit [Quit: I growing sleepy]
dm78 has joined #ruby-lang
banister has joined #ruby-lang
banister has quit [Max SendQ exceeded]
banister has joined #ruby-lang
godd2 has joined #ruby-lang
sheperson has joined #ruby-lang
karamazov has quit []
earthquake has quit [Quit: earthquake]
sdouglas has joined #ruby-lang
nathanstitt has joined #ruby-lang
sharpmachine has quit [Remote host closed the connection]
nathanstitt has quit [Client Quit]
bin7me has joined #ruby-lang
bin7me has quit [Client Quit]
wasamasa has joined #ruby-lang
mehlah has joined #ruby-lang
bin7me has joined #ruby-lang
sdouglas has quit [Read error: Connection reset by peer]
touzin has quit [Ping timeout: 240 seconds]
banister has quit [Ping timeout: 264 seconds]
jhass is now known as jhass|off
stardiviner has joined #ruby-lang
<wasamasa> hi
<wasamasa> why are there both #ruby and #ruby-lang?
sheperson has quit [Quit: sheperson]
theharshest has joined #ruby-lang
theharshest has quit [Client Quit]
dangerousdave has quit [Read error: Connection reset by peer]
dangerousdave has joined #ruby-lang
Lewix has quit [Remote host closed the connection]
iamcalledrob has joined #ruby-lang
banister has joined #ruby-lang
banister has quit [Max SendQ exceeded]
dangerousdave has quit [Ping timeout: 260 seconds]
relix has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
iamcalledrob has quit [Ping timeout: 272 seconds]
havenwood has quit [Ping timeout: 264 seconds]
havenwood has joined #ruby-lang
yubrew has joined #ruby-lang
banister has joined #ruby-lang
iamcalledrob has joined #ruby-lang
aero224 has quit [Remote host closed the connection]
yubrew has quit [Ping timeout: 248 seconds]
cored has joined #ruby-lang
iamcalledrob has quit [Ping timeout: 264 seconds]
<darix> wasamasa: historical reasons
theharshest has joined #ruby-lang
banister has quit [Ping timeout: 264 seconds]
<havenwood> wasamasa: one difference that keeps them apart is that #ruby-lang requires nick registration and #ruby doesn't
banister has joined #ruby-lang
sandbags has joined #ruby-lang
DivineEntity has quit [Ping timeout: 240 seconds]
sandbags has quit [Client Quit]
sandbags has joined #ruby-lang
MikaAK1 has joined #ruby-lang
MikaAK1 has quit [Client Quit]
sharpmachine has joined #ruby-lang
shevy has joined #ruby-lang
cored has quit [Ping timeout: 272 seconds]
sandbags0 has joined #ruby-lang
sandbags0 has quit [Client Quit]
sandbags has quit []
sandbags has joined #ruby-lang
dsferreira has quit [Quit: This computer has gone to sleep]
DivineEntity has joined #ruby-lang
MikaAK1 has joined #ruby-lang
MikaAK1 has quit [Client Quit]
DivineEntity has quit [Ping timeout: 248 seconds]
dm78 has quit [Remote host closed the connection]
Lewix has joined #ruby-lang
Lumio has quit [Quit: Lumio]
weems|mac has quit [Quit: weems|mac]
|jemc| has quit [Read error: Connection reset by peer]
twright has joined #ruby-lang
|jemc| has joined #ruby-lang
Jam_ has joined #ruby-lang
postmodern has quit [Quit: Leaving]
twright has quit [Read error: Connection reset by peer]
twright has joined #ruby-lang
tectonic has joined #ruby-lang
sharpmachine has quit [Remote host closed the connection]
breezy_ has quit [Remote host closed the connection]
yfeldblum has joined #ruby-lang
iamcalledrob has joined #ruby-lang
DivineEntity has joined #ruby-lang
iamcalledrob has quit [Ping timeout: 252 seconds]
marr has quit [Ping timeout: 264 seconds]
devgiant has quit [Quit: Leaving]
cored has joined #ruby-lang
bender_unit has joined #ruby-lang
arBmind1 has quit [Quit: Leaving.]
wallerdev has joined #ruby-lang
breezy_ has joined #ruby-lang
tectonic has quit []
dm78 has joined #ruby-lang
KM has joined #ruby-lang
vintik has quit [Remote host closed the connection]
KM is now known as Guest42191
VTLob has quit [Quit: VTLob]
mikecmpbll has quit [Quit: i've nodded off.]
yubrew has joined #ruby-lang
havenwood has quit [Remote host closed the connection]
yubrew has quit [Ping timeout: 264 seconds]
vintik has joined #ruby-lang
wallerdev has quit [Quit: wallerdev]
tectonic has joined #ruby-lang
simoz1111115 has quit [Ping timeout: 255 seconds]
bin7me has quit [Read error: Connection reset by peer]
tplpnm has joined #ruby-lang
dm78 has quit [Remote host closed the connection]
breezy_ has quit [Remote host closed the connection]
breezy_ has joined #ruby-lang
ta has joined #ruby-lang
ta__ has quit [Read error: Connection reset by peer]
iamcalledrob has joined #ruby-lang
tplpnm has quit []