Class: LightTr::Runner
- Inherits:
-
Object
- Object
- LightTr::Runner
- Defined in:
- lib/light_tr/runner.rb
Instance Attribute Summary collapse
-
#store ⇒ Object
readonly
Returns the value of attribute store.
-
#translator ⇒ Object
readonly
Returns the value of attribute translator.
Instance Method Summary collapse
-
#initialize(store, translator) ⇒ Runner
constructor
A new instance of Runner.
- #translate(target, text) ⇒ Object
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
#store ⇒ Object (readonly)
Returns the value of attribute store.
10 11 12 |
# File 'lib/light_tr/runner.rb', line 10 def store @store end |
#translator ⇒ Object (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 |