Class: JMAFeed::ResultEntry

Inherits:
Struct
  • Object
show all
Defined in:
lib/jma_feed/result_entry.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#authorObject

Returns the value of attribute author



1
2
3
# File 'lib/jma_feed/result_entry.rb', line 1

def author
  @author
end

#contentObject

Returns the value of attribute content



1
2
3
# File 'lib/jma_feed/result_entry.rb', line 1

def content
  @content
end

#idObject

Returns the value of attribute id



1
2
3
# File 'lib/jma_feed/result_entry.rb', line 1

def id
  @id
end

Returns the value of attribute link



1
2
3
# File 'lib/jma_feed/result_entry.rb', line 1

def link
  @link
end

#titleObject

Returns the value of attribute title



1
2
3
# File 'lib/jma_feed/result_entry.rb', line 1

def title
  @title
end

#updatedObject

Returns the value of attribute updated



1
2
3
# File 'lib/jma_feed/result_entry.rb', line 1

def updated
  @updated
end

Instance Method Details

#identifierObject



4
5
6
# File 'lib/jma_feed/result_entry.rb', line 4

def identifier
  @identifier ||= id.split('/').last.sub(/\.\w+\z/, '')
end

#identifier_componentsObject



8
9
10
# File 'lib/jma_feed/result_entry.rb', line 8

def identifier_components
  time, number, report_code, report_area_code = identifier.split('_')
end

#reportObject



16
17
18
19
# File 'lib/jma_feed/result_entry.rb', line 16

def report
  return nil if report_code.nil?
  @report ||= JMAFeed::Report.latest.detect{_1.has_code?(report_code)}
end

#report_area_codeObject



21
22
23
# File 'lib/jma_feed/result_entry.rb', line 21

def report_area_code
  @report_area_code ||= identifier_components[3]
end

#report_codeObject



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

def report_code
  @report_code ||= identifier_components[2]
end