Sha256: 235af1bc5ae28f94fb2a662818c9518f5bb9f6395da6e1c3b3cb32c32a50b275

Contents?: true

Size: 604 Bytes

Versions: 3

Compression:

Stored size: 604 Bytes

Contents

require 'observer'

module FactoryGirl
  class Evaluation
    include Observable

    def initialize(evaluator, attribute_assigner, to_create)
      @evaluator = evaluator
      @attribute_assigner = attribute_assigner
      @to_create = to_create
    end

    delegate :object, :hash, to: :@attribute_assigner

    def create(result_instance)
      case @to_create.arity
      when 2 then @to_create[result_instance, @evaluator]
      else @to_create[result_instance]
      end
    end

    def notify(name, result_instance)
      changed
      notify_observers(name, result_instance)
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
ffactory_girl-4.8.2 lib/factory_girl/evaluation.rb
factory_girl-4.9.0 lib/factory_girl/evaluation.rb
ffactory_girl-4.8.1 lib/factory_girl/evaluation.rb