Class: AdLocalize::Entities::Wording
- Inherits:
-
Object
- Object
- AdLocalize::Entities::Wording
- Defined in:
- lib/ad_localize/entities/wording.rb
Instance Attribute Summary collapse
-
#default_locale ⇒ Object
readonly
Returns the value of attribute default_locale.
-
#locale_wordings ⇒ Object
readonly
Returns the value of attribute locale_wordings.
Instance Method Summary collapse
- #default_locale?(locale:) ⇒ Boolean
-
#initialize(locale_wordings:, default_locale:) ⇒ Wording
constructor
A new instance of Wording.
- #locales ⇒ Object
- #translations_for(locale:) ⇒ Object
Constructor Details
#initialize(locale_wordings:, default_locale:) ⇒ Wording
Returns a new instance of Wording.
6 7 8 9 |
# File 'lib/ad_localize/entities/wording.rb', line 6 def initialize(locale_wordings:, default_locale:) @locale_wordings = locale_wordings @default_locale = default_locale end |
Instance Attribute Details
#default_locale ⇒ Object (readonly)
Returns the value of attribute default_locale.
4 5 6 |
# File 'lib/ad_localize/entities/wording.rb', line 4 def default_locale @default_locale end |
#locale_wordings ⇒ Object (readonly)
Returns the value of attribute locale_wordings.
4 5 6 |
# File 'lib/ad_localize/entities/wording.rb', line 4 def locale_wordings @locale_wordings end |
Instance Method Details
#default_locale?(locale:) ⇒ Boolean
19 20 21 |
# File 'lib/ad_localize/entities/wording.rb', line 19 def default_locale?(locale:) locale == @default_locale end |
#locales ⇒ Object
15 16 17 |
# File 'lib/ad_localize/entities/wording.rb', line 15 def locales @locale_wordings.map(&:locale) end |
#translations_for(locale:) ⇒ Object
11 12 13 |
# File 'lib/ad_localize/entities/wording.rb', line 11 def translations_for(locale:) @locale_wordings.find { |locale_wording| locale_wording.locale == locale } end |