Class: RubyTerraform::Commands::Output
- Defined in:
- lib/ruby_terraform/commands/output.rb
Instance Method Summary collapse
- #configure_command(builder, opts) ⇒ Object
- #do_after(opts) ⇒ Object
-
#initialize(**kwargs) ⇒ Output
constructor
A new instance of Output.
Methods inherited from Base
Constructor Details
#initialize(**kwargs) ⇒ Output
Returns a new instance of Output.
8 9 10 11 12 |
# File 'lib/ruby_terraform/commands/output.rb', line 8 def initialize(**kwargs) super(**kwargs) @stdout = StringIO.new unless defined?(@stdout) && @stdout.respond_to?(:string) end |
Instance Method Details
#configure_command(builder, opts) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/ruby_terraform/commands/output.rb', line 14 def configure_command(builder, opts) name = opts[:name] state = opts[:state] no_color = opts[:no_color] mod = opts[:module] builder = builder .with_subcommand('output') do |sub| sub = sub.with_flag('-no-color') if no_color sub = sub.with_option('-state', state) if state sub = sub.with_option('-module', mod) if mod sub end builder = builder.with_argument(name) if name builder end |
#do_after(opts) ⇒ Object
31 32 33 34 |
# File 'lib/ruby_terraform/commands/output.rb', line 31 def do_after(opts) result = stdout.string opts[:name] ? result.chomp : result end |