Class: IPFS::Content::Link

Inherits:
Object
  • Object
show all
Defined in:
lib/ipfs/content/link.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#hashcodeObject (readonly)

Returns the value of attribute hashcode.



4
5
6
# File 'lib/ipfs/content/link.rb', line 4

def hashcode
  @hashcode
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/ipfs/content/link.rb', line 4

def name
  @name
end

#sizeObject (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