Class: Pipeliner::Filter
- Inherits:
-
Object
- Object
- Pipeliner::Filter
- Defined in:
- lib/pipeliner/Filter.rb
Instance Attribute Summary collapse
-
#type ⇒ Object
readonly
type of Objects filter is to be applied to.
Instance Method Summary collapse
-
#filter(o) ⇒ Object
- o
-
Object from Pipeline Applies filter to Object.
-
#initialize(t) ⇒ Filter
constructor
- t
-
type of Objects filter is to be applied to Create a new Filter.
Constructor Details
#initialize(t) ⇒ Filter
- t
-
type of Objects filter is to be applied to
Create a new Filter
7 8 9 10 |
# File 'lib/pipeliner/Filter.rb', line 7 def initialize(t) raise ArgumentError.new('Expecting Class or String') unless [Class, String].include?(t.class) @type = t end |
Instance Attribute Details
#type ⇒ Object (readonly)
type of Objects filter is to be applied to
4 5 6 |
# File 'lib/pipeliner/Filter.rb', line 4 def type @type end |
Instance Method Details
#filter(o) ⇒ Object
- o
-
Object from Pipeline
Applies filter to Object
14 15 16 17 |
# File 'lib/pipeliner/Filter.rb', line 14 def filter(o) raise ArgumentError.new('Wrong type supplied to filter') unless Splib.type_of?(o, @type) do_filter(o) end |