Module: JCF::CLI::Command::Output
- Defined in:
- lib/jcf/cli/command.rb
Instance Attribute Summary collapse
-
#err ⇒ Object
readonly
Returns the value of attribute err.
-
#formatter ⇒ Object
readonly
Returns the value of attribute formatter.
-
#out ⇒ Object
readonly
Returns the value of attribute out.
Instance Method Summary collapse
Instance Attribute Details
#err ⇒ Object (readonly)
Returns the value of attribute err.
10 11 12 |
# File 'lib/jcf/cli/command.rb', line 10 def err @err end |
#formatter ⇒ Object (readonly)
Returns the value of attribute formatter.
10 11 12 |
# File 'lib/jcf/cli/command.rb', line 10 def formatter @formatter end |
#out ⇒ Object (readonly)
Returns the value of attribute out.
10 11 12 |
# File 'lib/jcf/cli/command.rb', line 10 def out @out end |
Instance Method Details
#call(*args, **opts) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/jcf/cli/command.rb', line 12 def call(*args, **opts) @out = opts[:output] ? File.new(opts[:output], "w") : $stdout @err = $stderr output = opts[:format] @output_file = opts[:output] @formatter = OutputFormatters.formatter(output) super(*args, **opts) ensure @out.close if @out && @out != $stdout end |