Module: FlatMap::Mapping::Reader::Formatted::Formats
- Included in:
- FlatMap::Mapping::Reader::Formatted
- Defined in:
- lib/flat_map/mapping/reader/formatted/formats.rb
Overview
Hosts various formats that can be applied to values read by mappings for post-processing.
Instance Method Summary collapse
-
#enum(value, property = :name) ⇒ Object
Return the specified
property
of avalue
which is supposed to be anenum
record. -
#i18n_l(value) ⇒ Object
Pass
value
toI18n::l
method.
Instance Method Details
#enum(value, property = :name) ⇒ Object
Return the specified property
of a value
which is supposed to be an enum
record. By default, uses :name
. However, :description
might be also useful for UI purposes.
22 23 24 |
# File 'lib/flat_map/mapping/reader/formatted/formats.rb', line 22 def enum(value, property = :name) value.send(property) if value end |
#i18n_l(value) ⇒ Object
Pass value
to I18n::l
method.
8 9 10 |
# File 'lib/flat_map/mapping/reader/formatted/formats.rb', line 8 def i18n_l(value) I18n::l(value) if value end |