class Foo
Bar = 10
end # => 10
Foo::Bar # => 10
Foo::Bar.class #=> Fixnum
Bar.class
NameError: uninitialized constant Object::Bar
from (irb):6
from /usr/local/ruby-1.9.2/bin/irb:12:in `<main>'
On Tuesday, August 27, 2013 6:20:07 AM UTC-4, Ruby-Forum.com User wrote:
>
> Here is my sample code:
>
>
> class Foo
> Bar = 10
> end
>
> Foo::Bar # => 10
> Foo::Bar.class # => Fixnum
> 10.class # => Fixnum
>
> Float::NAN # => NaN
> Float::NAN.class # => Float
> NaN.class
> # uninitialized constant NaN (NameError)
>
> --
> Posted via http://www.ruby-forum.com/.
>
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/32254486-51ae-438a-9258-d915ea135986%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.