Module: Mova::ReadStrategy::Lazy
- Included in:
- Translator
- Defined in:
- lib/mova/read_strategy/lazy.rb
Overview
This strategy is more perfomant with an in-memory storage, where read is cheap compared to a remote storage. It is included in Translator by default.
Instance Method Summary collapse
Instance Method Details
#read_first(locales, key_with_scopes) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/mova/read_strategy/lazy.rb', line 9 def read_first(locales, key_with_scopes) locales.each do |locale| key_with_scopes.each do |key| result = storage.read(Scope.join(locale, key)) return result if Mova.presence(result) end end nil end |