class Transformator::Transformation::Step
Attributes
transformation[RW]
Public Class Methods
new(transformation = nil, options = {})
click to toggle source
# File lib/transformator/transformation/step.rb, line 6 def initialize(transformation = nil, options = {}) if transformation.is_a?(Hash) options = transformation transformation = nil end if transformation @transformation = transformation else @transformation = Struct.new(:source, :target).new.tap do |_struct| _struct.source = options[:source] _struct.target = options[:target] end end end
Public Instance Methods
call()
click to toggle source
# File lib/transformator/transformation/step.rb, line 22 def call end
method_missing(method_name, *args, &block)
click to toggle source
Each step has transparent access to all methods of it's transformation
Calls superclass method
# File lib/transformator/transformation/step.rb, line 28 def method_missing(method_name, *args, &block) if @transformation.respond_to?(method_name) @transformation.send(method_name, *args, &block) else super end end
respond_to_missing?(method_name, include_private = false)
click to toggle source
Calls superclass method
# File lib/transformator/transformation/step.rb, line 36 def respond_to_missing?(method_name, include_private = false) @transformation.respond_to?(method_name) || super end
source()
click to toggle source
avoid method_missing
penalty for the most used transformation methods
# File lib/transformator/transformation/step.rb, line 41 def source; @transformation.source; end
source=(value)
click to toggle source
# File lib/transformator/transformation/step.rb, line 42 def source=(value); @transformation.source=(value); end
target()
click to toggle source
# File lib/transformator/transformation/step.rb, line 43 def target; @transformation.target; end
target=(value)
click to toggle source
# File lib/transformator/transformation/step.rb, line 44 def target=(value); @transformation.target=(value); end