Class: Jsonsql::Transformer
- Inherits:
-
Object
- Object
- Jsonsql::Transformer
- Defined in:
- lib/jsonsql/transformer.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(&block) ⇒ Transformer
constructor
A new instance of Transformer.
- #transform(row) ⇒ Object
Constructor Details
#initialize(&block) ⇒ Transformer
Returns a new instance of Transformer.
3 4 5 |
# File 'lib/jsonsql/transformer.rb', line 3 def initialize(&block) @transformation = block end |
Class Method Details
.transformer_with_string(string) ⇒ Object
11 12 13 14 |
# File 'lib/jsonsql/transformer.rb', line 11 def self.transformer_with_string(string) block = eval(string) Transformer.new(&block) end |
Instance Method Details
#transform(row) ⇒ Object
7 8 9 |
# File 'lib/jsonsql/transformer.rb', line 7 def transform(row) self.instance_exec(row, &@transformation) end |