class Representable::Populator

Constants

FindOrInstantiate

Public Class Methods

apply!(options) click to toggle source

pipeline: [StopOnExcluded, AssignName, ReadFragment, StopOnNotFound, OverwriteOnNil, AssignFragment, #<Representable::Function::CreateObject:0x9805a44>, #<Representable::Function::Decorate:0x9805a1c>, Deserialize, Set]

# File lib/representable/populator.rb, line 21
def self.apply!(options)
  return unless populator = options[:populator]

  options[:parse_pipeline] = ->(input, opts) do
    pipeline = Pipeline[*parse_functions] # TODO: AssignFragment
    pipeline = Pipeline::Insert.(pipeline, SetValue, delete: true) # remove the setter function.
    pipeline = Pipeline::Insert.(pipeline, populator, replace: CreateObject::Populator) # let the actual populator do the job.
    # puts pipeline.extend(Representable::Pipeline::Debug).inspect
    pipeline
  end
end