Method: DataTranslation#from_source

Defined in:
lib/data_translation.rb

#from_source(source, options = {}) ⇒ Object

Given a source object, returns the results of #transform if no processor is defined or the results of calling the processor block as defined by #processor.



126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/data_translation.rb', line 126

def from_source(source, options = {})
  results = transform(source, options)

  if @processor
    if @processor.arity == 1
      @processor.call(results)
    else
      @processor.call(results, source)
    end
  else
    results
  end
end