Class: Pgchief::Command::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/pgchief/command/base.rb

Overview

Base class for commands

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*params) ⇒ Base

Returns a new instance of Base.



13
14
15
16
17
18
# File 'lib/pgchief/command/base.rb', line 13

def initialize(*params)
  @params = params
  @conn = PG.connect(Pgchief::Config.pgurl)
rescue PG::ConnectionBad => e
  puts "Cannot connect to database. #{e.message}"
end

Instance Attribute Details

#connObject (readonly)

Returns the value of attribute conn.



11
12
13
# File 'lib/pgchief/command/base.rb', line 11

def conn
  @conn
end

#paramsObject (readonly)

Returns the value of attribute params.



11
12
13
# File 'lib/pgchief/command/base.rb', line 11

def params
  @params
end

Class Method Details

.call(*params) ⇒ Object



7
8
9
# File 'lib/pgchief/command/base.rb', line 7

def self.call(*params)
  new(*params).call
end

Instance Method Details

#callObject

Raises:

  • (NotImplementedError)


20
21
22
# File 'lib/pgchief/command/base.rb', line 20

def call
  raise NotImplementedError
end