Class: Mysqlknife::Parameters
- Inherits:
-
Object
- Object
- Mysqlknife::Parameters
- Defined in:
- lib/mysqlknife/parameters.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
writeonly
Sets the attribute connection.
-
#host ⇒ Object
Returns the value of attribute host.
-
#tool ⇒ Object
Returns the value of attribute tool.
Instance Method Summary collapse
- #connection_details ⇒ Object
- #connections ⇒ Object
- #host_selected ⇒ Object
- #hosts ⇒ Object
-
#initialize ⇒ Parameters
constructor
A new instance of Parameters.
- #slave_selected ⇒ Object
- #slaves ⇒ Object
- #tool_selected ⇒ Object
- #tools ⇒ Object
Constructor Details
#initialize ⇒ Parameters
Returns a new instance of Parameters.
8 9 10 |
# File 'lib/mysqlknife/parameters.rb', line 8 def initialize @cnf = Configs.instance end |
Instance Attribute Details
#connection=(value) ⇒ Object (writeonly)
Sets the attribute connection
5 6 7 |
# File 'lib/mysqlknife/parameters.rb', line 5 def connection=(value) @connection = value end |
#host ⇒ Object
Returns the value of attribute host.
6 7 8 |
# File 'lib/mysqlknife/parameters.rb', line 6 def host @host end |
#tool ⇒ Object
Returns the value of attribute tool.
6 7 8 |
# File 'lib/mysqlknife/parameters.rb', line 6 def tool @tool end |
Instance Method Details
#connection_details ⇒ Object
18 19 20 21 22 |
# File 'lib/mysqlknife/parameters.rb', line 18 def connection_details unless @connection.nil? puts @cnf.show(@connection) end end |
#connections ⇒ Object
12 13 14 15 16 |
# File 'lib/mysqlknife/parameters.rb', line 12 def connections if @connection.nil? puts @cnf.connections end end |
#host_selected ⇒ Object
46 47 48 49 50 51 52 53 54 55 |
# File 'lib/mysqlknife/parameters.rb', line 46 def host_selected if @connection.nil? == false && @host.nil? == false @cnf.hosts(@connection).each do |host| return @host = host if host.include?(@host) end false end end |
#hosts ⇒ Object
24 25 26 27 28 29 |
# File 'lib/mysqlknife/parameters.rb', line 24 def hosts if @connection.nil? == false && @host.nil? == true puts @cnf.hosts(@connection) end end |
#slave_selected ⇒ Object
57 58 59 60 61 62 63 64 65 66 |
# File 'lib/mysqlknife/parameters.rb', line 57 def slave_selected if @connection.nil? == false && @host.nil? == false @cnf.slaves(@connection).each do |host| return @host = host if host.include?(@host) end false end end |
#slaves ⇒ Object
31 32 33 34 35 36 |
# File 'lib/mysqlknife/parameters.rb', line 31 def slaves if @connection.nil? == false && @host.nil? == true puts @cnf.slaves(@connection) end end |
#tool_selected ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/mysqlknife/parameters.rb', line 68 def tool_selected if @connection.nil? == false && @host.nil? == false && @tool.nil? == false && @cnf.tools(@connection).include?(@tool) @cnf.hosts(@connection).each do |host| if host.include?(@host) @host = host @tool = @cnf.tool(@connection, @tool) return @tool end end end end |
#tools ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/mysqlknife/parameters.rb', line 38 def tools if @connection.nil? == false && @host.nil? == false && @tool.nil? == true puts @cnf.tools(@connection) end end |