Class: LightTr::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/light_tr/runner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(store, translator) ⇒ Runner

Returns a new instance of Runner.



5
6
7
8
# File 'lib/light_tr/runner.rb', line 5

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

Instance Attribute Details

#storeObject (readonly)

Returns the value of attribute store.



10
11
12
# File 'lib/light_tr/runner.rb', line 10

def store
  @store
end

#translatorObject (readonly)

Returns the value of attribute translator.



10
11
12
# File 'lib/light_tr/runner.rb', line 10

def translator
  @translator
end

Instance Method Details

#translate(target, text) ⇒ Object



12
13
14
# File 'lib/light_tr/runner.rb', line 12

def translate(target, text)
  store.load(target, text) || store.save(target, text, translator.translate(text, target))
end