Class: Middleman::Filter
- Inherits:
-
Object
- Object
- Middleman::Filter
- Includes:
- Comparable, Contracts
- Defined in:
- middleman-core/lib/middleman-core/filter.rb
Direct Known Subclasses
Constant Summary
Constants included from Contracts
Instance Attribute Summary collapse
-
#after_filter ⇒ Object
readonly
Returns the value of attribute after_filter.
-
#filter_name ⇒ Object
readonly
Returns the value of attribute filter_name.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #execute_filter(_body) ⇒ Object
-
#initialize(filter_name, options_hash = ::Middleman::EMPTY_HASH) ⇒ Filter
constructor
A new instance of Filter.
Methods included from Contracts
Constructor Details
#initialize(filter_name, options_hash = ::Middleman::EMPTY_HASH) ⇒ Filter
Returns a new instance of Filter.
31 32 33 34 35 36 |
# File 'middleman-core/lib/middleman-core/filter.rb', line 31 def initialize(filter_name, = ::Middleman::EMPTY_HASH) @filter_name = filter_name @options = @after_filter = @options.fetch(:after_filter, nil) end |
Instance Attribute Details
#after_filter ⇒ Object (readonly)
Returns the value of attribute after_filter.
16 17 18 |
# File 'middleman-core/lib/middleman-core/filter.rb', line 16 def after_filter @after_filter end |
#filter_name ⇒ Object (readonly)
Returns the value of attribute filter_name.
13 14 15 |
# File 'middleman-core/lib/middleman-core/filter.rb', line 13 def filter_name @filter_name end |
Instance Method Details
#<=>(other) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'middleman-core/lib/middleman-core/filter.rb', line 18 def <=>(other) shift = if other.after_filter.nil? 0 elsif filter_name == other.after_filter 1 else -1 end [0, object_id] <=> [shift, other.object_id] end |
#execute_filter(_body) ⇒ Object
39 40 41 |
# File 'middleman-core/lib/middleman-core/filter.rb', line 39 def execute_filter(_body) raise NotImplementedError end |