Class: Filtrum::TypeSerializer
- Inherits:
-
Object
- Object
- Filtrum::TypeSerializer
- Defined in:
- lib/filtrum/type_serializer.rb
Instance Method Summary collapse
-
#initialize(type, block) ⇒ TypeSerializer
constructor
A new instance of TypeSerializer.
- #match?(value) ⇒ Boolean
- #serialize(value) ⇒ Object
Constructor Details
#initialize(type, block) ⇒ TypeSerializer
Returns a new instance of TypeSerializer.
5 6 7 |
# File 'lib/filtrum/type_serializer.rb', line 5 def initialize type, block @type, @block = type, block end |
Instance Method Details
#match?(value) ⇒ Boolean
9 10 11 |
# File 'lib/filtrum/type_serializer.rb', line 9 def match? value value.kind_of? @type end |
#serialize(value) ⇒ Object
13 14 15 |
# File 'lib/filtrum/type_serializer.rb', line 13 def serialize value @block.call value end |