Class: StreetNames::Database

Inherits:
Object
  • Object
show all
Defined in:
lib/street_names/database.rb

Instance Method Summary collapse

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