Class: Kitchen::LifecycleHook::Base
- Inherits:
-
Object
- Object
- Kitchen::LifecycleHook::Base
- Defined in:
- lib/kitchen/lifecycle_hook/base.rb
Instance Attribute Summary collapse
-
#hook ⇒ Object
readonly
return [Hash].
- #lifecycle_hooks ⇒ Kitchen::LifecycleHooks readonly
-
#phase ⇒ Object
readonly
return [String].
Instance Method Summary collapse
-
#initialize(lifecycle_hooks, phase, hook) ⇒ Base
constructor
A new instance of Base.
-
#logger ⇒ Logger
private
The lifecycle hooks’s logger otherwise.
-
#run ⇒ Object
return [void].
- #should_run? ⇒ TrueClass, FalseClass
Constructor Details
#initialize(lifecycle_hooks, phase, hook) ⇒ Base
Returns a new instance of Base.
16 17 18 19 20 |
# File 'lib/kitchen/lifecycle_hook/base.rb', line 16 def initialize(lifecycle_hooks, phase, hook) @lifecycle_hooks = lifecycle_hooks @phase = phase @hook = hook end |
Instance Attribute Details
#hook ⇒ Object (readonly)
return [Hash]
11 12 13 |
# File 'lib/kitchen/lifecycle_hook/base.rb', line 11 def hook @hook end |
#lifecycle_hooks ⇒ Kitchen::LifecycleHooks (readonly)
5 6 7 |
# File 'lib/kitchen/lifecycle_hook/base.rb', line 5 def lifecycle_hooks @lifecycle_hooks end |
#phase ⇒ Object (readonly)
return [String]
8 9 10 |
# File 'lib/kitchen/lifecycle_hook/base.rb', line 8 def phase @phase end |
Instance Method Details
#logger ⇒ Logger
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns the lifecycle hooks’s logger otherwise.
41 42 43 |
# File 'lib/kitchen/lifecycle_hook/base.rb', line 41 def logger lifecycle_hooks.send(:logger) end |
#run ⇒ Object
return [void]
23 24 25 |
# File 'lib/kitchen/lifecycle_hook/base.rb', line 23 def run raise NotImplementedError end |
#should_run? ⇒ TrueClass, FalseClass
28 29 30 31 32 33 34 35 36 |
# File 'lib/kitchen/lifecycle_hook/base.rb', line 28 def should_run? if !includes.empty? includes.include?(platform_name) elsif !excludes.empty? !excludes.include?(platform_name) else true end end |