Class: SimpleFactory::Definition
- Inherits:
-
Object
- Object
- SimpleFactory::Definition
- Defined in:
- lib/simple_factory/definition.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name, value_or_callable) ⇒ Definition
constructor
A new instance of Definition.
- #value ⇒ Object
Constructor Details
#initialize(name, value_or_callable) ⇒ Definition
Returns a new instance of Definition.
5 6 7 8 |
# File 'lib/simple_factory/definition.rb', line 5 def initialize(name, value_or_callable) @name = name @value_or_callable = value_or_callable end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/simple_factory/definition.rb', line 3 def name @name end |
Instance Method Details
#value ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/simple_factory/definition.rb', line 10 def value if @value_or_callable.respond_to?(:call) @value_or_callable.call else @value_or_callable end end |