Class: Mysqlknife::Parameter::Command
- Defined in:
- lib/mysqlknife/parameter/command.rb
Instance Attribute Summary collapse
-
#cmd ⇒ Object
writeonly
Sets the attribute cmd.
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#connections, #hosts, #initialize
Constructor Details
This class inherits a constructor from Mysqlknife::Parameter::Base
Instance Attribute Details
#cmd=(value) ⇒ Object (writeonly)
Sets the attribute cmd
6 7 8 |
# File 'lib/mysqlknife/parameter/command.rb', line 6 def cmd=(value) @cmd = value end |
Instance Method Details
#commands ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/mysqlknife/parameter/command.rb', line 8 def commands if @connection.nil? == false && @host.nil? == false && @cmd.nil? puts "Commands:" if @config.commands.nil? == false && @config.commands.count > 0 && @config.commands.is_a?(Array) @config.commands.each do |command| puts " - #{command}" end end end end |
#connect ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/mysqlknife/parameter/command.rb', line 23 def connect if @connection.nil? == false && @host.nil? == false && @cmd.nil? == false @config.connection(@connection) puts "Connecting to: #{@config.select(@host)}" @command.execute(@mysql.parse(@config.command(@cmd))) end end |