Why the `singleton` methods can't be defined on 
`Fixnum`,`Bignum`,`Float`,`Symbol` class objects, but ` FalseClass` and 
`TrueClass` can have?

    C:\>ruby -v
    ruby 2.0.0p0 (2013-02-24) [i386-mingw32]

    C:\>irb --simple-prompt
    DL is deprecated, please use Fiddle
    11111111111.class
    #=> Bignum
    # class << 11111111111 ; end
    #TypeError: can't define singleton
    #        from (irb):2
    #        from C:/Ruby200/bin/irb:12:in `<main>'

    1111.class
    #=> Fixnum
    class << 1111 ; end
    #TypeError: can't define singleton
    #       from (irb):4
    #       from C:/Ruby200/bin/irb:12:in `<main>'

    11.11.class
    #=> Float
    class << 11.11 ; end
    #TypeError: can't define singleton
    #       from (irb):6
    #       from C:/Ruby200/bin/irb:12:in `<main>'

    :name.class
    #=> Symbol
    class << :name ; end
    #TypeError: can't define singleton
    #       from (irb):8
    #       from C:/Ruby200/bin/irb:12:in `<main>'

`true` and `false` object also has fixed `object_id`. Why are then they 
allowed to have `singleton` methods on them?

    C:\>irb --simple-prompt
    DL is deprecated, please use Fiddle

    def true.test ; end
    #=> nil

    class << true
    def show
    p "How possible?"
    end
    end
    #=> nil

    true.show
    #"How possible?"
    #=> "How possible?"

    true.object_id
    #=> 2
    true.object_id
    #=> 2

    class << false
    def show
    p "How possible?"
    end
    end
    #=> nil

    false.show
    #"How possible?"
    #=> "How possible?"

    false.object_id
    #=> 0
    false.object_id
    #=> 0

-- 
Posted via http://www.ruby-forum.com/.