Class: AdLocalize::Entities::Wording

Inherits:
Object
  • Object
show all
Defined in:
lib/ad_localize/entities/wording.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_localeObject (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_wordingsObject (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

Returns:

  • (Boolean)


19
20
21
# File 'lib/ad_localize/entities/wording.rb', line 19

def default_locale?(locale:)
  locale == @default_locale
end

#localesObject



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