Class: Bogus::FakeDefinition

Inherits:
Object
  • Object
show all
Defined in:
lib/bogus/fake_configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ FakeDefinition

Returns a new instance of FakeDefinition.



39
40
41
42
43
44
# File 'lib/bogus/fake_configuration.rb', line 39

def initialize(attrs = {})
  @name = attrs[:name]
  @class_block = attrs[:class_block]
  @opts = attrs[:opts] || {}
  @stubs = attrs[:stubs] || {}
end

Instance Attribute Details

#class_blockObject (readonly)

Returns the value of attribute class_block.



37
38
39
# File 'lib/bogus/fake_configuration.rb', line 37

def class_block
  @class_block
end

#nameObject (readonly)

Returns the value of attribute name.



37
38
39
# File 'lib/bogus/fake_configuration.rb', line 37

def name
  @name
end

#optsObject (readonly)

Returns the value of attribute opts.



37
38
39
# File 'lib/bogus/fake_configuration.rb', line 37

def opts
  @opts
end

#stubsObject (readonly)

Returns the value of attribute stubs.



37
38
39
# File 'lib/bogus/fake_configuration.rb', line 37

def stubs
  @stubs
end

Instance Method Details

#merge(other) ⇒ Object



46
47
48
49
50
51
# File 'lib/bogus/fake_configuration.rb', line 46

def merge(other)
  FakeDefinition.new(name: other.name,
                    opts: opts.merge(other.opts),
                    stubs: stubs.merge(other.stubs),
                    class_block: other.class_block || class_block)
end