Class: StreetNames::Database
- Inherits:
-
Object
- Object
- StreetNames::Database
- Defined in:
- lib/street_names/database.rb
Instance Method Summary collapse
-
#initialize(locale = LOCALE) ⇒ Database
constructor
A new instance of Database.
- #load_streets(data = nil) ⇒ Object
- #save!(data) ⇒ Object
Constructor Details
#initialize(locale = LOCALE) ⇒ Database
Returns a new instance of Database.
6 7 8 |
# File 'lib/street_names/database.rb', line 6 def initialize locale=LOCALE @locale = locale end |
Instance Method Details
#load_streets(data = nil) ⇒ Object
10 11 12 |
# File 'lib/street_names/database.rb', line 10 def load_streets data=nil datastore.transaction { data = datastore[:"streets_#{@locale}"] } end |
#save!(data) ⇒ Object
14 15 16 |
# File 'lib/street_names/database.rb', line 14 def save! data datastore.transaction { datastore[:"streets_#{@locale}"] = data[:streets] } end |