Module: Peregrine::Features::Nameable
- Defined in:
- lib/peregrine/features/nameable.rb
Overview
Provides methods for naming objects. Intended to be included in classes requiring this functionality.
Instance Method Summary collapse
-
#name ⇒ Object
Returns the name of the object.
-
#name=(value) ⇒ Object
Sets the name of the object to the given value after String coercion.
Instance Method Details
#name ⇒ Object
Returns the name of the object. Lazily evaluated.
7 8 9 |
# File 'lib/peregrine/features/nameable.rb', line 7 def name @name ||= self.class.to_s end |
#name=(value) ⇒ Object
Sets the name of the object to the given value after String coercion.
12 13 14 |
# File 'lib/peregrine/features/nameable.rb', line 12 def name=(value) @name = value.to_s end |