Class: Stove::Filter
- Inherits:
-
Object
- Object
- Stove::Filter
- Includes:
- Logify, Mixin::Insideable
- Defined in:
- lib/stove/filter.rb
Instance Attribute Summary collapse
-
#block ⇒ Proc
readonly
The block captured by the filter.
-
#klass ⇒ ~Plugin::Base
readonly
The class that created this filter.
-
#message ⇒ String
readonly
The message given by the filter.
Instance Method Summary collapse
-
#initialize(klass, message, &block) ⇒ Filter
constructor
Create a new filter object.
-
#run(cookbook, options = {}) ⇒ Object
Execute this filter in the context of the creating class, inside the given cookbook’s path.
Methods included from Mixin::Insideable
Constructor Details
#initialize(klass, message, &block) ⇒ Filter
Create a new filter object.
38 39 40 41 42 |
# File 'lib/stove/filter.rb', line 38 def initialize(klass, , &block) @klass = klass @message = @block = block end |
Instance Attribute Details
#block ⇒ Proc (readonly)
The block captured by the filter.
26 27 28 |
# File 'lib/stove/filter.rb', line 26 def block @block end |
#klass ⇒ ~Plugin::Base (readonly)
The class that created this filter.
12 13 14 |
# File 'lib/stove/filter.rb', line 12 def klass @klass end |
#message ⇒ String (readonly)
The message given by the filter.
19 20 21 |
# File 'lib/stove/filter.rb', line 19 def @message end |
Instance Method Details
#run(cookbook, options = {}) ⇒ Object
Execute this filter in the context of the creating class, inside the given cookbook’s path.
51 52 53 54 55 56 57 58 |
# File 'lib/stove/filter.rb', line 51 def run(cookbook, = {}) log.info() instance = klass.new(cookbook, ) inside(cookbook) do instance.instance_eval(&block) end end |