Class: Layer::Patch::Base
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Layer::Patch::Base
- Defined in:
- lib/layer/patch/base.rb
Instance Attribute Summary collapse
-
#patch ⇒ Object
readonly
Returns the value of attribute patch.
Instance Method Summary collapse
-
#initialize(patch, object) ⇒ Base
constructor
A new instance of Base.
- #wrap(property, object) ⇒ Object
Constructor Details
#initialize(patch, object) ⇒ Base
Returns a new instance of Base.
7 8 9 10 |
# File 'lib/layer/patch/base.rb', line 7 def initialize(patch, object) @patch = patch super(prepare_base(object)) end |
Instance Attribute Details
#patch ⇒ Object (readonly)
Returns the value of attribute patch.
5 6 7 |
# File 'lib/layer/patch/base.rb', line 5 def patch @patch end |
Instance Method Details
#wrap(property, object) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/layer/patch/base.rb', line 12 def wrap(property, object) case object when ::Array return Layer::Patch::Array.new(patch.nested(property), object) when ::Hash return Layer::Patch::Hash.new(patch.nested(property), object) else object end end |