Class: Bipm::Data::Outcomes::Meeting
- Inherits:
-
Object
- Object
- Bipm::Data::Outcomes::Meeting
- Includes:
- Enumerable
- Defined in:
- lib/bipm/data/outcomes/meeting.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Instance Method Summary collapse
- #date ⇒ Object
- #document ⇒ Object
- #each(&block) ⇒ Object
- #file_path ⇒ Object
-
#initialize(body, id) ⇒ Meeting
constructor
A new instance of Meeting.
- #pdf ⇒ Object
- #resolution(name) ⇒ Object (also: #[])
- #resolutions ⇒ Object
- #source ⇒ Object
- #title ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(body, id) ⇒ Meeting
Returns a new instance of Meeting.
8 9 10 11 12 13 |
# File 'lib/bipm/data/outcomes/meeting.rb', line 8 def initialize(body, id) @id = id @body = body raise IndexError unless File.exist? file_path end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
15 16 17 |
# File 'lib/bipm/data/outcomes/meeting.rb', line 15 def body @body end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
15 16 17 |
# File 'lib/bipm/data/outcomes/meeting.rb', line 15 def id @id end |
Instance Method Details
#date ⇒ Object
30 31 32 |
# File 'lib/bipm/data/outcomes/meeting.rb', line 30 def date Date.parse(document["metadata"]["date"]) end |
#document ⇒ Object
21 22 23 |
# File 'lib/bipm/data/outcomes/meeting.rb', line 21 def document YAML.load(File.open(file_path)) end |
#each(&block) ⇒ Object
56 57 58 |
# File 'lib/bipm/data/outcomes/meeting.rb', line 56 def each(&block) resolutions.values.each(&block) end |
#file_path ⇒ Object
17 18 19 |
# File 'lib/bipm/data/outcomes/meeting.rb', line 17 def file_path "#{@body.file_path}meeting-#{id}.yml" end |
#pdf ⇒ Object
42 43 44 |
# File 'lib/bipm/data/outcomes/meeting.rb', line 42 def pdf document["pdf"] end |
#resolution(name) ⇒ Object Also known as: []
47 48 49 |
# File 'lib/bipm/data/outcomes/meeting.rb', line 47 def resolution(name) Resolution.new(self, name) end |
#resolutions ⇒ Object
52 53 54 |
# File 'lib/bipm/data/outcomes/meeting.rb', line 52 def resolutions document["resolutions"].each_with_index.to_h { |_,name| [name, resolution(name)] } end |
#source ⇒ Object
34 35 36 |
# File 'lib/bipm/data/outcomes/meeting.rb', line 34 def source document["metadata"]["source"] end |
#title ⇒ Object
26 27 28 |
# File 'lib/bipm/data/outcomes/meeting.rb', line 26 def title document["metadata"]["title"] end |
#url ⇒ Object
38 39 40 |
# File 'lib/bipm/data/outcomes/meeting.rb', line 38 def url document["metadata"]["source"] end |