Class: Mysqlknife::Parameter::Base
- Inherits:
-
Object
- Object
- Mysqlknife::Parameter::Base
- Defined in:
- lib/mysqlknife/parameter/base.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
writeonly
Sets the attribute connection.
-
#host ⇒ Object
writeonly
Sets the attribute host.
Instance Method Summary collapse
- #connections ⇒ Object
- #hosts ⇒ Object
-
#initialize ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize ⇒ Base
Returns a new instance of Base.
8 9 10 11 12 |
# File 'lib/mysqlknife/parameter/base.rb', line 8 def initialize @command = Mysqlknife::Command.new @config = Mysqlknife::Configs.instance @mysql = Mysqlknife::Mysql.new end |
Instance Attribute Details
#connection=(value) ⇒ Object (writeonly)
Sets the attribute connection
6 7 8 |
# File 'lib/mysqlknife/parameter/base.rb', line 6 def connection=(value) @connection = value end |
#host=(value) ⇒ Object (writeonly)
Sets the attribute host
6 7 8 |
# File 'lib/mysqlknife/parameter/base.rb', line 6 def host=(value) @host = value end |
Instance Method Details
#connections ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/mysqlknife/parameter/base.rb', line 14 def connections if @connection.nil? puts "Connections:" @config.connections.each do |conn| puts " - #{conn}" end end end |
#hosts ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/mysqlknife/parameter/base.rb', line 23 def hosts if @connection.nil? == false && @host.nil? == true @config.connection(@connection) puts "Hosts for connection: #{@connection}" if @config.hosts.nil? == false && @config.hosts.count > 0 && @config.hosts.is_a?(Array) @config.hosts.each do |host| puts " - #{host}" end end end end |