Class: RubyTerraform::Commands::Output

Inherits:
Base
  • Object
show all
Defined in:
lib/ruby_terraform/commands/output.rb

Instance Attribute Summary

Attributes inherited from Base

#binary

Instance Method Summary collapse

Methods inherited from Base

#do_before, #execute, #initialize, #instantiate_builder, #stderr, #stdin

Constructor Details

This class inherits a constructor from RubyTerraform::Commands::Base

Instance Method Details

#configure_command(builder, opts) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/ruby_terraform/commands/output.rb', line 13

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



30
31
32
33
# File 'lib/ruby_terraform/commands/output.rb', line 30

def do_after(opts)
  result = @stdout.string
  opts[:name] ? result.chomp : result
end

#stdoutObject



8
9
10
11
# File 'lib/ruby_terraform/commands/output.rb', line 8

def stdout
  @stdout = StringIO.new unless
      defined?(@stdout) && @stdout.respond_to?(:string)
end