Class: Hotdog::Commands::BaseCommand
- Inherits:
-
Object
- Object
- Hotdog::Commands::BaseCommand
show all
- Defined in:
- lib/hotdog/commands.rb
Constant Summary
collapse
- PERSISTENT_DB =
"persistent.db"
- MASK_DATABASE =
0xffff0000
- MASK_QUERY =
0x0000ffff
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(application) ⇒ BaseCommand
21
22
23
24
25
26
27
|
# File 'lib/hotdog/commands.rb', line 21
def initialize(application)
@application = application
@logger = application.options[:logger]
@options = application.options
@dog = nil
@prepared_statements = {}
end
|
Instance Attribute Details
#application ⇒ Object
Returns the value of attribute application.
28
29
30
|
# File 'lib/hotdog/commands.rb', line 28
def application
@application
end
|
#logger ⇒ Object
Returns the value of attribute logger.
29
30
31
|
# File 'lib/hotdog/commands.rb', line 29
def logger
@logger
end
|
#options ⇒ Object
Returns the value of attribute options.
30
31
32
|
# File 'lib/hotdog/commands.rb', line 30
def options
@options
end
|
Instance Method Details
#define_options(optparse, options = {}) ⇒ Object
53
54
55
|
# File 'lib/hotdog/commands.rb', line 53
def define_options(optparse, options={})
end
|
#execute(q, args = []) ⇒ Object
36
37
38
39
|
# File 'lib/hotdog/commands.rb', line 36
def execute(q, args=[])
update_db
execute_db(@db, q, args)
end
|
#fixed_string? ⇒ Boolean
41
42
43
|
# File 'lib/hotdog/commands.rb', line 41
def fixed_string?()
@options[:fixed_string]
end
|
#parse_options(optparse, args = []) ⇒ Object
57
58
59
|
# File 'lib/hotdog/commands.rb', line 57
def parse_options(optparse, args=[])
optparse.parse(args)
end
|
#reload(options = {}) ⇒ Object
45
46
47
48
49
50
51
|
# File 'lib/hotdog/commands.rb', line 45
def reload(options={})
if @db
close_db(@db)
@db = nil
end
update_db(options)
end
|
#run(args = [], options = {}) ⇒ Object
32
33
34
|
# File 'lib/hotdog/commands.rb', line 32
def run(args=[], options={})
raise(NotImplementedError)
end
|