Class: Metalink4FileHash
- Inherits:
-
Object
- Object
- Metalink4FileHash
- Defined in:
- lib/metalink4.rb
Overview
Because hash can’t just be a string. We need to specify what type.
Instance Attribute Summary collapse
-
#hash_type ⇒ Object
Returns the value of attribute hash_type.
-
#hash_value ⇒ Object
Returns the value of attribute hash_value.
-
#piece ⇒ Object
Returns the value of attribute piece.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Metalink4FileHash
constructor
A new instance of Metalink4FileHash.
Constructor Details
#initialize(opts = {}) ⇒ Metalink4FileHash
Returns a new instance of Metalink4FileHash.
18 19 20 21 22 23 24 |
# File 'lib/metalink4.rb', line 18 def initialize(opts = {}) opts = opts.inject({}){ |r, (k,v)| r[k.to_sym] = v; r } self.hash_value = opts.fetch(:hash_value, nil) self.hash_type = opts.fetch(:hash_type, nil) self.piece = opts.fetch(:piece, nil) end |
Instance Attribute Details
#hash_type ⇒ Object
Returns the value of attribute hash_type.
14 15 16 |
# File 'lib/metalink4.rb', line 14 def hash_type @hash_type end |
#hash_value ⇒ Object
Returns the value of attribute hash_value.
14 15 16 |
# File 'lib/metalink4.rb', line 14 def hash_value @hash_value end |
#piece ⇒ Object
Returns the value of attribute piece.
14 15 16 |
# File 'lib/metalink4.rb', line 14 def piece @piece end |