Class: Germinate::ShellProcess
- Inherits:
-
Object
- Object
- Germinate::ShellProcess
- Defined in:
- lib/germinate/shell_process.rb
Overview
A ShellProcess represents an external command which can be used to process a Hunk of text.
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#variables ⇒ Object
readonly
Returns the value of attribute variables.
Instance Method Summary collapse
- #call(input) ⇒ Object
-
#initialize(name, command, variables = {}) ⇒ ShellProcess
constructor
A new instance of ShellProcess.
Constructor Details
#initialize(name, command, variables = {}) ⇒ ShellProcess
Returns a new instance of ShellProcess.
15 16 17 18 19 |
# File 'lib/germinate/shell_process.rb', line 15 def initialize(name, command, variables={}) @name = name @command = command @variables = variables end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
10 11 12 |
# File 'lib/germinate/shell_process.rb', line 10 def command @command end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/germinate/shell_process.rb', line 9 def name @name end |
#variables ⇒ Object (readonly)
Returns the value of attribute variables.
11 12 13 |
# File 'lib/germinate/shell_process.rb', line 11 def variables @variables end |
Instance Method Details
#call(input) ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/germinate/shell_process.rb', line 21 def call(input) if pipe? call_command_in_pipe(input) elsif input.whole_file? call_command_on_source_file(input) else call_command_on_temp_file(input) end end |