Class: EacRubyUtils::Envs::BaseCommand::AppendCommandOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/eac_ruby_utils/envs/base_command/append_command_options.rb

Instance Method Summary collapse

Instance Method Details

#inputEacRubyUtils::Envs::Command?

Returns:



22
23
24
# File 'lib/eac_ruby_utils/envs/base_command/append_command_options.rb', line 22

def input
  options[:input]
end

#input_filePathname?

Returns:



27
28
29
# File 'lib/eac_ruby_utils/envs/base_command/append_command_options.rb', line 27

def input_file
  options[:input_file].if_present(&:to_pathname)
end

#output_filePathname?

Returns:



32
33
34
# File 'lib/eac_ruby_utils/envs/base_command/append_command_options.rb', line 32

def output_file
  options[:output_file].if_present(&:to_pathname)
end

#resultObject



13
14
15
16
17
18
19
# File 'lib/eac_ruby_utils/envs/base_command/append_command_options.rb', line 13

def result
  r = command_line
  r = "#{input.command} | #{r}" if input
  r = "cat #{Shellwords.escape(input_file)} | #{r}" if input_file
  r += " > #{Shellwords.escape(output_file)}" if output_file
  r
end