Class: Sidetree::Model::Suffix
- Inherits:
-
Object
- Object
- Sidetree::Model::Suffix
- Defined in:
- lib/sidetree/model/suffix.rb
Instance Attribute Summary collapse
-
#delta_hash ⇒ Object
readonly
Returns the value of attribute delta_hash.
-
#recovery_commitment ⇒ Object
readonly
Returns the value of attribute recovery_commitment.
Class Method Summary collapse
-
.from_object(object) ⇒ Sidetree::Model::Suffix
Create Suffix object from hash object.
Instance Method Summary collapse
-
#initialize(delta_hash, recovery_commitment) ⇒ Suffix
constructor
A new instance of Suffix.
-
#to_h ⇒ Hash
Convert data to Hash object.
-
#unique_suffix ⇒ String
Calculate unique suffix.
Constructor Details
#initialize(delta_hash, recovery_commitment) ⇒ Suffix
Returns a new instance of Suffix.
8 9 10 11 |
# File 'lib/sidetree/model/suffix.rb', line 8 def initialize(delta_hash, recovery_commitment) @delta_hash = delta_hash @recovery_commitment = recovery_commitment end |
Instance Attribute Details
#delta_hash ⇒ Object (readonly)
Returns the value of attribute delta_hash.
4 5 6 |
# File 'lib/sidetree/model/suffix.rb', line 4 def delta_hash @delta_hash end |
#recovery_commitment ⇒ Object (readonly)
Returns the value of attribute recovery_commitment.
4 5 6 |
# File 'lib/sidetree/model/suffix.rb', line 4 def recovery_commitment @recovery_commitment end |
Class Method Details
.from_object(object) ⇒ Sidetree::Model::Suffix
Create Suffix object from hash object.
16 17 18 19 |
# File 'lib/sidetree/model/suffix.rb', line 16 def self.from_object(object) Sidetree::Validator.validate_suffix_data!(object) Suffix.new(object[:deltaHash], object[:recoveryCommitment]) end |
Instance Method Details
#to_h ⇒ Hash
Convert data to Hash object.
23 24 25 |
# File 'lib/sidetree/model/suffix.rb', line 23 def to_h { deltaHash: delta_hash, recoveryCommitment: recovery_commitment } end |