Ruby on Rails Tuesday, August 27, 2013

NAN is namespaced under Float. So you can only access it through Float::NAN.

-- 
Dheeraj Kumar

On Tuesday 27 August 2013 at 6:08 PM, jsnark wrote:

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 rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
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.

--
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 rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/AB56DB7A5D974897A92DE95577D9F274%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment