Class: Bmg::TupleTransformer
- Inherits:
-
Object
- Object
- Bmg::TupleTransformer
- Defined in:
- lib/bmg/support/tuple_transformer.rb
Constant Summary collapse
- Callable =
->(t) { t.respond_to?(:call) }
Class Method Summary collapse
Instance Method Summary collapse
- #call(tuple) ⇒ Object
-
#initialize(transformation) ⇒ TupleTransformer
constructor
A new instance of TupleTransformer.
- #knows_attrlist? ⇒ Boolean
- #to_attrlist ⇒ Object
Constructor Details
#initialize(transformation) ⇒ TupleTransformer
Returns a new instance of TupleTransformer.
6 7 8 |
# File 'lib/bmg/support/tuple_transformer.rb', line 6 def initialize(transformation) @transformation = transformation end |
Class Method Details
.new(arg) ⇒ Object
10 11 12 13 |
# File 'lib/bmg/support/tuple_transformer.rb', line 10 def self.new(arg) return arg if arg.is_a?(TupleTransformer) super end |
Instance Method Details
#call(tuple) ⇒ Object
15 16 17 |
# File 'lib/bmg/support/tuple_transformer.rb', line 15 def call(tuple) transform_tuple(tuple, @transformation) end |
#knows_attrlist? ⇒ Boolean
19 20 21 |
# File 'lib/bmg/support/tuple_transformer.rb', line 19 def knows_attrlist? @transformation.is_a?(Hash) end |
#to_attrlist ⇒ Object
23 24 25 |
# File 'lib/bmg/support/tuple_transformer.rb', line 23 def to_attrlist @transformation.keys end |