Class: Dbmanager::Runner
- Inherits:
-
Object
- Object
- Dbmanager::Runner
- Defined in:
- lib/dbmanager/runner.rb
Instance Attribute Summary collapse
-
#environments ⇒ Object
readonly
Returns the value of attribute environments.
-
#input ⇒ Object
readonly
Returns the value of attribute input.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
Instance Method Summary collapse
- #get_env(type) ⇒ Object
- #get_filename(type, default_filename) ⇒ Object
-
#initialize(input = STDIN, output = STDOUT) ⇒ Runner
constructor
A new instance of Runner.
Constructor Details
#initialize(input = STDIN, output = STDOUT) ⇒ Runner
Returns a new instance of Runner.
5 6 7 8 9 |
# File 'lib/dbmanager/runner.rb', line 5 def initialize(input=STDIN, output=STDOUT) @input = input @output = output @environments = YmlParser.environments end |
Instance Attribute Details
#environments ⇒ Object (readonly)
Returns the value of attribute environments.
3 4 5 |
# File 'lib/dbmanager/runner.rb', line 3 def environments @environments end |
#input ⇒ Object (readonly)
Returns the value of attribute input.
3 4 5 |
# File 'lib/dbmanager/runner.rb', line 3 def input @input end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
3 4 5 |
# File 'lib/dbmanager/runner.rb', line 3 def output @output end |
Instance Method Details
#get_env(type) ⇒ Object
11 12 13 14 |
# File 'lib/dbmanager/runner.rb', line 11 def get_env(type) output.puts "\nPlease choose #{type} db:\n\n" choose_environment end |
#get_filename(type, default_filename) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/dbmanager/runner.rb', line 16 def get_filename(type, default_filename) output.print "\nPlease choose #{type} file (defaults to #{default_filename}): " filename = get_input if filename.blank? default_filename else absolute_path(filename) end end |