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.
18 19 20 21 22 |
# File 'lib/kitchen/lifecycle_hook/base.rb', line 18 def initialize(lifecycle_hooks, phase, hook) @lifecycle_hooks = lifecycle_hooks @phase = phase @hook = hook end |
Instance Attribute Details
#hook ⇒ Object (readonly)
return [Hash]
13 14 15 |
# File 'lib/kitchen/lifecycle_hook/base.rb', line 13 def hook @hook end |
#lifecycle_hooks ⇒ Kitchen::LifecycleHooks (readonly)
7 8 9 |
# File 'lib/kitchen/lifecycle_hook/base.rb', line 7 def lifecycle_hooks @lifecycle_hooks end |
#phase ⇒ Object (readonly)
return [String]
10 11 12 |
# File 'lib/kitchen/lifecycle_hook/base.rb', line 10 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.
43 44 45 |
# File 'lib/kitchen/lifecycle_hook/base.rb', line 43 def logger lifecycle_hooks.send(:logger) end |
#run ⇒ Object
return [void]
25 26 27 |
# File 'lib/kitchen/lifecycle_hook/base.rb', line 25 def run raise NotImplementedError end |
#should_run? ⇒ TrueClass, FalseClass
30 31 32 33 34 35 36 37 38 |
# File 'lib/kitchen/lifecycle_hook/base.rb', line 30 def should_run? if !includes.empty? includes.include?(platform_name) elsif !excludes.empty? !excludes.include?(platform_name) else true end end |