Class: Hana::Patch
- Inherits:
-
Object
- Object
- Hana::Patch
- Defined in:
- lib/hana.rb
Defined Under Namespace
Classes: Exception, FailedTestException, IndexError, MissingTargetException, ObjectOperationOnArrayException, OutOfBoundsException
Constant Summary collapse
- VALID =
:nodoc:
Instance Method Summary collapse
- #apply(doc) ⇒ Object
-
#initialize(is) ⇒ Patch
constructor
A new instance of Patch.
Constructor Details
#initialize(is) ⇒ Patch
Returns a new instance of Patch.
66 67 68 |
# File 'lib/hana.rb', line 66 def initialize is @is = is end |
Instance Method Details
#apply(doc) ⇒ Object
72 73 74 75 76 77 78 |
# File 'lib/hana.rb', line 72 def apply doc @is.inject(doc) { |d, ins| send VALID.fetch(ins[OP].strip) { |k| raise Exception, "bad method `#{k}`" }, ins, d } end |