Class: Rspec::Bash::StubFunction
- Inherits:
-
Object
- Object
- Rspec::Bash::StubFunction
- Defined in:
- lib/rspec/bash/wrapper/stub_function.rb
Instance Method Summary collapse
- #body(name) ⇒ Object
- #footer(name) ⇒ Object
- #header(name) ⇒ Object
-
#initialize(port, stub_script_class) ⇒ StubFunction
constructor
A new instance of StubFunction.
- #script(name) ⇒ Object
Constructor Details
#initialize(port, stub_script_class) ⇒ StubFunction
Returns a new instance of StubFunction.
4 5 6 7 |
# File 'lib/rspec/bash/wrapper/stub_function.rb', line 4 def initialize(port, stub_script_class) @port = port @stub_script_class = stub_script_class end |
Instance Method Details
#body(name) ⇒ Object
17 18 19 |
# File 'lib/rspec/bash/wrapper/stub_function.rb', line 17 def body(name) "#{stub_path} #{name} #{@port} \"${@}\"" end |
#footer(name) ⇒ Object
13 14 15 |
# File 'lib/rspec/bash/wrapper/stub_function.rb', line 13 def (name) "}\ncommand readonly -f #{name} &> /dev/null" end |
#header(name) ⇒ Object
9 10 11 |
# File 'lib/rspec/bash/wrapper/stub_function.rb', line 9 def header(name) "function #{name} {" end |
#script(name) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/rspec/bash/wrapper/stub_function.rb', line 21 def script(name) <<-multiline_string #{header(name)} #{body(name)} #{(name)} multiline_string end |