Class: OpenGeoDb::Database

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

Defined Under Namespace

Classes: UnknownActionError

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Database

Returns a new instance of Database.



6
7
8
9
10
# File 'lib/open_geo_db/database.rb', line 6

def initialize(config)
  @database = config["database"]
  @username = config["username"]
  @password = "-p#{config["password"]}" if config["password"]
end

Instance Method Details

#execute(action) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/open_geo_db/database.rb', line 12

def execute(action)
  case action
  when :create then create
  when :destroy then destroy
  else
    raise UnknownActionError, action
  end
end