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
permalink #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
permalink .new(arg) ⇒ Object
[View source]
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
permalink #call(tuple) ⇒ Object
[View source]
15 16 17 |
# File 'lib/bmg/support/tuple_transformer.rb', line 15 def call(tuple) transform_tuple(tuple, @transformation) end |
permalink #knows_attrlist? ⇒ Boolean
19 20 21 |
# File 'lib/bmg/support/tuple_transformer.rb', line 19 def knows_attrlist? @transformation.is_a?(Hash) end |
permalink #to_attrlist ⇒ Object
[View source]
23 24 25 |
# File 'lib/bmg/support/tuple_transformer.rb', line 23 def to_attrlist @transformation.keys end |