A
Alin Popa
Hi,
I noticed soon something weird about Object documentation (in fact, one
of my colleagues saw it and he asked me what's the catch):
- Object class (http://www.ruby-doc.org/core/classes/Object.html) have
one method called to_yaml. Now, the funny thing is that when trying to
do that:
irb(main):001:0> a = "abc"
=> "abc"
irb(main):002:0> a.to_yaml
NoMethodError: undefined method `to_yaml' for "abc":String
from (irb):2
from :0
but after require 'yaml' everything is ok.
Ok, I know that yaml is placing this method to Object class when
required, but why is it by default documented in Object class ? What may
be the reason ?
Thanks.
I noticed soon something weird about Object documentation (in fact, one
of my colleagues saw it and he asked me what's the catch):
- Object class (http://www.ruby-doc.org/core/classes/Object.html) have
one method called to_yaml. Now, the funny thing is that when trying to
do that:
irb(main):001:0> a = "abc"
=> "abc"
irb(main):002:0> a.to_yaml
NoMethodError: undefined method `to_yaml' for "abc":String
from (irb):2
from :0
but after require 'yaml' everything is ok.
Ok, I know that yaml is placing this method to Object class when
required, but why is it by default documented in Object class ? What may
be the reason ?
Thanks.