Class: Bipm::Data::Outcomes::LocalizedBody

Inherits:
Body
  • Object
show all
Includes:
Enumerable
Defined in:
lib/bipm/data/outcomes/localized_body.rb

Instance Attribute Summary collapse

Attributes inherited from Body

#body

Instance Method Summary collapse

Methods inherited from Body

#locales

Constructor Details

#initialize(body, locale) ⇒ LocalizedBody

Returns a new instance of LocalizedBody.



5
6
7
8
# File 'lib/bipm/data/outcomes/localized_body.rb', line 5

def initialize(body, locale)
  super
  @locale = locale
end

Instance Attribute Details

#localeObject (readonly)

Returns the value of attribute locale.



10
11
12
# File 'lib/bipm/data/outcomes/localized_body.rb', line 10

def locale
  @locale
end

Instance Method Details

#each(&block) ⇒ Object



30
31
32
# File 'lib/bipm/data/outcomes/localized_body.rb', line 30

def each(&block)
  meetings.values.each(&block)
end

#file_pathObject



12
13
14
# File 'lib/bipm/data/outcomes/localized_body.rb', line 12

def file_path
  "#{super}meetings-#{@locale}/"
end

#meeting(name) ⇒ Object Also known as: []



17
18
19
# File 'lib/bipm/data/outcomes/localized_body.rb', line 17

def meeting(name)
  Meeting.new(self, name)
end

#meetingsObject



22
23
24
25
26
27
28
# File 'lib/bipm/data/outcomes/localized_body.rb', line 22

def meetings
  Dir["#{file_path}*"].to_h do |name|
    name = name.split("/").last.split("-", 2).last.split(".").first
    
    [name, meeting(name)]
  end
end