Class: RegistersClient::Item

Inherits:
Object
  • Object
show all
Defined in:
lib/item.rb

Instance Method Summary collapse

Constructor Details

#initialize(rsf_line) ⇒ Item

Returns a new instance of Item.



5
6
7
8
9
10
# File 'lib/item.rb', line 5

def initialize(rsf_line)
  @item_json = rsf_line.split("\t")[1]
  @item_hash = 'sha-256:' + Digest::SHA256.hexdigest(@item_json)

  @parsed_item = nil
end

Instance Method Details

#has_end_dateObject



20
21
22
23
24
25
26
# File 'lib/item.rb', line 20

def has_end_date
  if !@item_json.nil?
    !@item_json.index("end-date").nil?
  else
    !@parsed_item['end-date'].nil?
  end
end

#hashObject



12
13
14
# File 'lib/item.rb', line 12

def hash
  @item_hash
end

#valueObject



16
17
18
# File 'lib/item.rb', line 16

def value
  get_item
end