Class: FakeApi::Factory
- Inherits:
-
Object
- Object
- FakeApi::Factory
- Defined in:
- lib/fake_api/factory.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(name:, value: nil, &block) ⇒ Factory
constructor
A new instance of Factory.
- #returns(new_value = nil, &block) ⇒ Object
Constructor Details
#initialize(name:, value: nil, &block) ⇒ Factory
Returns a new instance of Factory.
4 5 6 7 |
# File 'lib/fake_api/factory.rb', line 4 def initialize(name:, value: nil, &block) @name = name @value = value || block end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/fake_api/factory.rb', line 3 def name @name end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
3 4 5 |
# File 'lib/fake_api/factory.rb', line 3 def value @value end |
Instance Method Details
#returns(new_value = nil, &block) ⇒ Object
9 10 11 12 |
# File 'lib/fake_api/factory.rb', line 9 def returns(new_value = nil, &block) @value = new_value || block self end |