method
anonymous?
v7.1.3.4 -
Show latest stable
-
0 notes -
Class: Module
- 1.0.0
- 1.1.6
- 1.2.6
- 2.0.3
- 2.1.0
- 2.2.1
- 2.3.8
- 3.0.0 (0)
- 3.0.9 (-5)
- 3.1.0 (0)
- 3.2.1 (0)
- 3.2.8 (0)
- 3.2.13 (0)
- 4.0.2 (0)
- 4.1.8 (0)
- 4.2.1 (0)
- 4.2.7 (0)
- 4.2.9 (0)
- 5.0.0.1 (38)
- 5.1.7 (0)
- 5.2.3 (0)
- 6.0.0 (0)
- 6.1.3.1 (0)
- 6.1.7.7 (0)
- 7.0.0 (0)
- 7.1.3.2 (0)
- 7.1.3.4 (0)
- What's this?
anonymous?()
public
A module may or may not have a name.
module M; end M.name # => "M" m = Module.new m.name # => nil
anonymous? method returns true if module does not have a name, false otherwise:
Module.new.anonymous? # => true module M; end M.anonymous? # => false
A module gets a name when it is first assigned to a constant. Either via the module or class keyword or by an explicit assignment:
m = Module.new # creates an anonymous module m.anonymous? # => true M = m # m gets a name here as a side-effect m.name # => "M" m.anonymous? # => false