Class: Bipm::Data::Outcomes::Body
- Inherits:
-
Object
- Object
- Bipm::Data::Outcomes::Body
- Includes:
- Enumerable
- Defined in:
- lib/bipm/data/outcomes/body.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
Instance Method Summary collapse
- #each(&block) ⇒ Object
- #file_path ⇒ Object
-
#initialize(body, locale = nil) ⇒ Body
constructor
A new instance of Body.
- #locale(name) ⇒ Object (also: #[])
- #locales ⇒ Object
Constructor Details
#initialize(body, locale = nil) ⇒ Body
Returns a new instance of Body.
5 6 7 |
# File 'lib/bipm/data/outcomes/body.rb', line 5 def initialize(body, locale = nil) @body = body end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
9 10 11 |
# File 'lib/bipm/data/outcomes/body.rb', line 9 def body @body end |
Instance Method Details
#each(&block) ⇒ Object
25 26 27 |
# File 'lib/bipm/data/outcomes/body.rb', line 25 def each(&block) locales.values.each(&block) end |
#file_path ⇒ Object
11 12 13 |
# File 'lib/bipm/data/outcomes/body.rb', line 11 def file_path "#{Outcomes.file_path}#{@body}/" end |
#locale(name) ⇒ Object Also known as: []
16 17 18 |
# File 'lib/bipm/data/outcomes/body.rb', line 16 def locale(name) LocalizedBody.new(@body, name) end |
#locales ⇒ Object
21 22 23 |
# File 'lib/bipm/data/outcomes/body.rb', line 21 def locales %i[fr en].to_h { |name| [name, locale(name)] } end |