Class: IPFS::Content::Link
- Inherits:
-
Object
- Object
- IPFS::Content::Link
- Defined in:
- lib/ipfs/content/link.rb
Instance Attribute Summary collapse
-
#hashcode ⇒ Object
readonly
Returns the value of attribute hashcode.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name:, hashcode:, size:) ⇒ Link
constructor
A new instance of Link.
Constructor Details
#initialize(name:, hashcode:, size:) ⇒ Link
Returns a new instance of Link.
6 7 8 9 10 |
# File 'lib/ipfs/content/link.rb', line 6 def initialize(name:, hashcode:, size:) @name = name @hashcode = hashcode @size = size end |
Instance Attribute Details
#hashcode ⇒ Object (readonly)
Returns the value of attribute hashcode.
4 5 6 |
# File 'lib/ipfs/content/link.rb', line 4 def hashcode @hashcode end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/ipfs/content/link.rb', line 4 def name @name end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
4 5 6 |
# File 'lib/ipfs/content/link.rb', line 4 def size @size end |
Class Method Details
.parse_array(array) ⇒ Object
12 13 14 15 16 |
# File 'lib/ipfs/content/link.rb', line 12 def self.parse_array(array) array.map do |item| parse_single(item) end end |
.parse_single(item) ⇒ Object
18 19 20 |
# File 'lib/ipfs/content/link.rb', line 18 def self.parse_single(item) new name: item['Name'], hashcode: item['Hash'], size: item['Size'] end |