Class: Vito::Connection
- Inherits:
-
Object
- Object
- Vito::Connection
- Defined in:
- lib/vito/connection.rb
Defined Under Namespace
Classes: Output
Instance Method Summary collapse
-
#initialize(type, args = {}) ⇒ Connection
constructor
A new instance of Connection.
- #query(command) ⇒ Object
- #run(command) ⇒ Object
Constructor Details
#initialize(type, args = {}) ⇒ Connection
Returns a new instance of Connection.
5 6 7 8 |
# File 'lib/vito/connection.rb', line 5 def initialize(type, args = {}) = {} [:command] = args[:command] end |
Instance Method Details
#query(command) ⇒ Object
10 11 12 13 |
# File 'lib/vito/connection.rb', line 10 def query(command) command = final_command(command) execute_command(command) end |
#run(command) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/vito/connection.rb', line 15 def run(command) command = final_command(command) Log.write "* Executing: #{command}" output = execute_command(command) unless output.success? Log.write "An error occurred. Here's the stacktrace:" Log.write output.result Log.write "" end output end |