Class: FakeApi::Factory

Inherits:
Object
  • Object
show all
Defined in:
lib/fake_api/factory.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/fake_api/factory.rb', line 3

def name
  @name
end

#valueObject (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