Class: YamlTranslator::Context

Inherits:
Object
  • Object
show all
Defined in:
lib/yaml-translator/context.rb

Direct Known Subclasses

DiffContext, FileContext, StringContext

Instance Method Summary collapse

Constructor Details

#initialize(locale, translator) ⇒ Context

Returns a new instance of Context.



3
4
5
6
# File 'lib/yaml-translator/context.rb', line 3

def initialize(locale, translator)
  @locale = locale
  @translator = translator
end

Instance Method Details

#all(targets) ⇒ Object



12
13
14
# File 'lib/yaml-translator/context.rb', line 12

def all(targets)
  targets.map { |target| @locale.translate(@translator, to: target) }
end

#to(target) ⇒ Object



8
9
10
# File 'lib/yaml-translator/context.rb', line 8

def to(target)
  @locale.translate(@translator, to: target)
end