Class: Stove::Filter
- Inherits:
-
Object
- Object
- Stove::Filter
- Includes:
- 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.
36 37 38 39 40 |
# File 'lib/stove/filter.rb', line 36 def initialize(klass, , &block) @klass = klass @message = @block = block end |
Instance Attribute Details
#block ⇒ Proc (readonly)
The block captured by the filter.
24 25 26 |
# File 'lib/stove/filter.rb', line 24 def block @block end |
#klass ⇒ ~Plugin::Base (readonly)
The class that created this filter.
10 11 12 |
# File 'lib/stove/filter.rb', line 10 def klass @klass end |
#message ⇒ String (readonly)
The message given by the filter.
17 18 19 |
# File 'lib/stove/filter.rb', line 17 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.
49 50 51 52 53 54 55 56 |
# File 'lib/stove/filter.rb', line 49 def run(cookbook, = {}) Stove::Log.info() instance = klass.new(cookbook, ) inside(cookbook) do instance.instance_eval(&block) end end |