Class: JSON::Patch
- Inherits:
-
Object
- Object
- JSON::Patch
- Defined in:
- lib/json/patch.rb,
lib/json/patch/version.rb
Constant Summary collapse
- VERSION =
"0.2.1"
Instance Attribute Summary collapse
-
#hunks ⇒ Object
readonly
Returns the value of attribute hunks.
Instance Method Summary collapse
-
#apply_to(object) ⇒ Object
Apply this patch to an object.
-
#initialize(hunks) ⇒ Patch
constructor
A new instance of Patch.
Constructor Details
Instance Attribute Details
#hunks ⇒ Object (readonly)
Returns the value of attribute hunks.
5 6 7 |
# File 'lib/json/patch.rb', line 5 def hunks @hunks end |
Instance Method Details
#apply_to(object) ⇒ Object
Apply this patch to an object
The object to be modified (which may be nested inside the object in the method signature) MUST implement #apply_patch.
#apply_patch should return true if the patch can be succesfully applied and false otherwise.
If any hunk in the patch cannot be applied successfully, the PATCH rfc dictates that the entire patch MUST not be applied. This atomicity must be handled by the #apply_patch implementation.
23 24 25 |
# File 'lib/json/patch.rb', line 23 def apply_to(object) object.apply_patch(self)# if object.respond_to?(:apply_patch) end |