Class: Bogus::FakeDefinition
- Inherits:
-
Object
- Object
- Bogus::FakeDefinition
- Defined in:
- lib/bogus/fake_configuration.rb
Instance Attribute Summary collapse
-
#class_block ⇒ Object
readonly
Returns the value of attribute class_block.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#opts ⇒ Object
readonly
Returns the value of attribute opts.
-
#stubs ⇒ Object
readonly
Returns the value of attribute stubs.
Instance Method Summary collapse
-
#initialize(attrs = {}) ⇒ FakeDefinition
constructor
A new instance of FakeDefinition.
- #merge(other) ⇒ Object
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_block ⇒ Object (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 |
#name ⇒ Object (readonly)
Returns the value of attribute name.
37 38 39 |
# File 'lib/bogus/fake_configuration.rb', line 37 def name @name end |
#opts ⇒ Object (readonly)
Returns the value of attribute opts.
37 38 39 |
# File 'lib/bogus/fake_configuration.rb', line 37 def opts @opts end |
#stubs ⇒ Object (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 |