Class: Spacialdb::Command::Db

Inherits:
Base
  • Object
show all
Defined in:
lib/spacialdb/command/db.rb

Overview

manage databases (list, create, destroy)

Instance Attribute Summary

Attributes inherited from Base

#args, #options

Instance Method Summary collapse

Methods inherited from Base

#initialize, namespace, #spacialdb

Methods included from Helpers

#ask, #confirm_command, #display, #echo_off, #echo_on, #error, #home_directory, #json_decode, #json_encode, #longest, #redisplay

Constructor Details

This class inherits a constructor from Spacialdb::Command::Base

Instance Method Details

#createObject

db:create

create a new database



21
22
23
# File 'lib/spacialdb/command/db.rb', line 21

def create
  display spacialdb.create
end

#destroyObject

db:destroy

permanently destroy a database



31
32
33
34
35
36
37
38
# File 'lib/spacialdb/command/db.rb', line 31

def destroy
  db = extract_db
  if confirm_command(db)
    redisplay "Destroying #{db} ... "
    spacialdb.destroy(db)
    display "done"
  end
end

#indexObject

db

list your databases



11
12
13
# File 'lib/spacialdb/command/db.rb', line 11

def index
  display spacialdb.list.join("\n")
end