Class: Banzai::Filter
- Inherits:
-
Object
- Object
- Banzai::Filter
- Defined in:
- lib/banzai/filter.rb
Overview
Filter transforms an input into desired output. The process of transformation should be implemented in the #call method.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
-
.call(input) ⇒ Object
Delegates to #call by creating an instance with default options.
Instance Method Summary collapse
-
#call(input) ⇒ Object
Subclass should redefine this method to transform input to desired output.
-
#initialize(options = {}) ⇒ Filter
constructor
A new instance of Filter.
Constructor Details
#initialize(options = {}) ⇒ Filter
Returns a new instance of Filter.
9 10 11 |
# File 'lib/banzai/filter.rb', line 9 def initialize( = {}) @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/banzai/filter.rb', line 5 def @options end |
Class Method Details
.call(input) ⇒ Object
Delegates to #call by creating an instance with default options
24 25 26 |
# File 'lib/banzai/filter.rb', line 24 def self.call(input) new.call(input) end |
Instance Method Details
#call(input) ⇒ Object
Subclass should redefine this method to transform input to desired output
17 18 19 |
# File 'lib/banzai/filter.rb', line 17 def call(input) input end |