Module: CommandExec::FieldHelper
- Included in:
- CommandExec::Formatter::Array, CommandExec::Formatter::Hash, Process
- Defined in:
- lib/command_exec/field_helper.rb
Overview
Shared methods for fields
Instance Method Summary collapse
-
#end_time(value) ⇒ Array
Set the end time of command execution.
-
#executable(value) ⇒ Array
Set the path to the executable of the command.
-
#initialize ⇒ Object
Initialize helper.
-
#log_file(*content) ⇒ Array
Set the content of the log file.
-
#pid(value) ⇒ Array
Set the pid of the command.
-
#reason_for_failure(*content) ⇒ Array
Set the reason for failure.
-
#return_code(value) ⇒ Array
Set the return code of the command.
-
#start_time(value) ⇒ Array
Set the start time of command execution.
-
#stderr(*content) ⇒ Array
Set the content of stderr.
-
#stdout(*content) ⇒ Array
Set the content of stdout.
Instance Method Details
#end_time(value) ⇒ Array
Set the end time of command execution
259 260 261 |
# File 'lib/command_exec/field_helper.rb', line 259 def end_time(value) @end_time[0] = value end |
#executable(value) ⇒ Array
Set the path to the executable of the command
237 238 239 |
# File 'lib/command_exec/field_helper.rb', line 237 def executable(value) @executable[0] = value end |
#initialize ⇒ Object
Initialize helper
will be used from array and hash via super call although there's no inheritance. See for more information http://stackoverflow.com/questions/1645398/ruby-include-question
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/command_exec/field_helper.rb', line 13 def initialize @end_time = [] @executable = [] @log_file = [] @pid = [] @reason_for_failure = [] @return_code = [] @start_time = [] @status = [] @stderr = [] @stdout = [] end |
#log_file(*content) ⇒ Array
Set the content of the log file
172 173 174 |
# File 'lib/command_exec/field_helper.rb', line 172 def log_file(*content) @log_file += content.flatten end |
#pid(value) ⇒ Array
Set the pid of the command
214 215 216 217 218 |
# File 'lib/command_exec/field_helper.rb', line 214 def pid(value) @pid[0] = value.to_s @pid end |
#reason_for_failure(*content) ⇒ Array
Set the reason for failure
226 227 228 |
# File 'lib/command_exec/field_helper.rb', line 226 def reason_for_failure(*content) @reason_for_failure += content.flatten end |
#return_code(value) ⇒ Array
Set the return code of the command
182 183 184 185 186 |
# File 'lib/command_exec/field_helper.rb', line 182 def return_code(value) @return_code[0] = value.to_s @return_code end |
#start_time(value) ⇒ Array
Set the start time of command execution
248 249 250 |
# File 'lib/command_exec/field_helper.rb', line 248 def start_time(value) @start_time[0] = value end |
#stderr(*content) ⇒ Array
Set the content of stderr
204 205 206 |
# File 'lib/command_exec/field_helper.rb', line 204 def stderr(*content) @stderr += content.flatten end |
#stdout(*content) ⇒ Array
Set the content of stdout
194 195 196 |
# File 'lib/command_exec/field_helper.rb', line 194 def stdout(*content) @stdout += content.flatten end |