Class: Sidetree::Model::Delta
- Inherits:
-
Object
- Object
- Sidetree::Model::Delta
- Defined in:
- lib/sidetree/model/delta.rb
Instance Attribute Summary collapse
-
#patches ⇒ Object
readonly
Returns the value of attribute patches.
-
#update_commitment ⇒ Object
readonly
Returns the value of attribute update_commitment.
Class Method Summary collapse
-
.from_object(object) ⇒ Sidetree::Model::Delta
Create delta object from hash object.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(patches, update_commitment) ⇒ Delta
constructor
Initializer.
- #to_h ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(patches, update_commitment) ⇒ Delta
Initializer
10 11 12 13 |
# File 'lib/sidetree/model/delta.rb', line 10 def initialize(patches, update_commitment) @patches = patches @update_commitment = update_commitment end |
Instance Attribute Details
#patches ⇒ Object (readonly)
Returns the value of attribute patches.
4 5 6 |
# File 'lib/sidetree/model/delta.rb', line 4 def patches @patches end |
#update_commitment ⇒ Object (readonly)
Returns the value of attribute update_commitment.
4 5 6 |
# File 'lib/sidetree/model/delta.rb', line 4 def update_commitment @update_commitment end |
Class Method Details
.from_object(object) ⇒ Sidetree::Model::Delta
Create delta object from hash object.
18 19 20 21 |
# File 'lib/sidetree/model/delta.rb', line 18 def self.from_object(object) Sidetree::Validator.validate_delta!(object) Delta.new(object[:patches], object[:updateCommitment]) end |
Instance Method Details
#==(other) ⇒ Object
31 32 33 34 |
# File 'lib/sidetree/model/delta.rb', line 31 def ==(other) return false unless other.is_a?(Delta) to_hash == other.to_hash end |
#to_h ⇒ Object
23 24 25 |
# File 'lib/sidetree/model/delta.rb', line 23 def to_h { patches: patches, updateCommitment: update_commitment } end |