Class: YleTf::Action::TfHooks
- Inherits:
-
Object
- Object
- YleTf::Action::TfHooks
- Defined in:
- lib/yle_tf/action/tf_hooks.rb
Defined Under Namespace
Classes: NoRunner
Instance Method Summary collapse
- #call(env) ⇒ Object
- #hook_env ⇒ Object
- #hook_runner ⇒ Object
-
#initialize(app) ⇒ TfHooks
constructor
A new instance of TfHooks.
- #run_hooks? ⇒ Boolean
Constructor Details
#initialize(app) ⇒ TfHooks
Returns a new instance of TfHooks.
12 13 14 |
# File 'lib/yle_tf/action/tf_hooks.rb', line 12 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/yle_tf/action/tf_hooks.rb', line 16 def call(env) @env = env hook_runner.run('pre') @app.call(env) hook_runner.run('post') end |
#hook_env ⇒ Object
32 33 34 35 36 37 |
# File 'lib/yle_tf/action/tf_hooks.rb', line 32 def hook_env { 'TF_COMMAND' => @env[:tf_command], 'TF_ENV' => @env[:tf_env], } end |
#hook_runner ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/yle_tf/action/tf_hooks.rb', line 24 def hook_runner if run_hooks? TfHook::Runner.new(@env[:config], hook_env) else NoRunner end end |
#run_hooks? ⇒ Boolean
39 40 41 |
# File 'lib/yle_tf/action/tf_hooks.rb', line 39 def run_hooks? !@env[:tf_options][:no_hooks] end |