Class: ThatLanguage::Store
- Inherits:
-
Object
- Object
- ThatLanguage::Store
- Defined in:
- lib/that_language/store.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #exists? ⇒ Boolean
-
#initialize(path) ⇒ Store
constructor
A new instance of Store.
- #to_h ⇒ Object
Constructor Details
#initialize(path) ⇒ Store
Returns a new instance of Store.
7 8 9 |
# File 'lib/that_language/store.rb', line 7 def initialize(path) @path = path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
5 6 7 |
# File 'lib/that_language/store.rb', line 5 def path @path end |
Instance Method Details
#exists? ⇒ Boolean
23 24 25 |
# File 'lib/that_language/store.rb', line 23 def exists? File.exists?(path) end |
#to_h ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/that_language/store.rb', line 11 def to_h Hash.new.tap do |hash| within_pstore do # FIXME: Change `pstore[:locales]` to pstore[:language_codes] hash[:language_codes] = pstore[:locales] hash[:language_codes].each do |language_code| hash[language_code] = pstore[language_code] end end end end |