Class: Hotdog::Commands::BaseCommand
- Inherits:
-
Object
- Object
- Hotdog::Commands::BaseCommand
- Defined in:
- lib/hotdog/commands.rb
Instance Attribute Summary collapse
-
#application ⇒ Object
readonly
Returns the value of attribute application.
-
#confdir ⇒ Object
readonly
Returns the value of attribute confdir.
-
#expiry ⇒ Object
readonly
Returns the value of attribute expiry.
-
#force ⇒ Object
readonly
Returns the value of attribute force.
-
#formatter ⇒ Object
readonly
Returns the value of attribute formatter.
-
#listing ⇒ Object
readonly
Returns the value of attribute listing.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
Instance Method Summary collapse
- #execute(query, *args) ⇒ Object
- #fixed_string? ⇒ Boolean
-
#initialize(options = {}) ⇒ BaseCommand
constructor
A new instance of BaseCommand.
- #run(args = []) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ BaseCommand
Returns a new instance of BaseCommand.
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/hotdog/commands.rb', line 11 def initialize(={}) @application = [:application] @confdir = [:confdir] @expiry = [:expiry] @fixed_string = [:fixed_string] @force = [:force] @formatter = [:formatter] @listing = [:listing] @logger = [:logger] = [:tags] = @dog = Dogapi::Client.new([:api_key], [:application_key]) end |
Instance Attribute Details
#application ⇒ Object (readonly)
Returns the value of attribute application.
24 25 26 |
# File 'lib/hotdog/commands.rb', line 24 def application @application end |
#confdir ⇒ Object (readonly)
Returns the value of attribute confdir.
25 26 27 |
# File 'lib/hotdog/commands.rb', line 25 def confdir @confdir end |
#expiry ⇒ Object (readonly)
Returns the value of attribute expiry.
26 27 28 |
# File 'lib/hotdog/commands.rb', line 26 def expiry @expiry end |
#force ⇒ Object (readonly)
Returns the value of attribute force.
27 28 29 |
# File 'lib/hotdog/commands.rb', line 27 def force @force end |
#formatter ⇒ Object (readonly)
Returns the value of attribute formatter.
28 29 30 |
# File 'lib/hotdog/commands.rb', line 28 def formatter @formatter end |
#listing ⇒ Object (readonly)
Returns the value of attribute listing.
29 30 31 |
# File 'lib/hotdog/commands.rb', line 29 def listing @listing end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
30 31 32 |
# File 'lib/hotdog/commands.rb', line 30 def logger @logger end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
32 33 34 |
# File 'lib/hotdog/commands.rb', line 32 def end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
31 32 33 |
# File 'lib/hotdog/commands.rb', line 31 def end |
Instance Method Details
#execute(query, *args) ⇒ Object
38 39 40 41 42 43 44 45 46 |
# File 'lib/hotdog/commands.rb', line 38 def execute(query, *args) update_db q = query.strip if 0 < args.length q += " -- VALUES (#{args.map { |arg| Array === arg ? "(#{arg.join(", ")})" : arg.inspect }.join(", ")})" end logger.debug(q) @db.execute(query, args) end |
#fixed_string? ⇒ Boolean
48 49 50 |
# File 'lib/hotdog/commands.rb', line 48 def fixed_string?() @fixed_string end |
#run(args = []) ⇒ Object
34 35 36 |
# File 'lib/hotdog/commands.rb', line 34 def run(args=[]) raise(NotImplementedError) end |