Sha256: c73760adcc2996f3b56cb19b00d69ea1d8a398d907c7e2890a1810dd2bf0fb54

Contents?: true

Size: 435 Bytes

Versions: 12

Compression:

Stored size: 435 Bytes

Contents

module FactoryGirl
  class Attribute #:nodoc:

    class Dynamic < Attribute  #:nodoc:
      def initialize(name, block)
        super(name)
        @block = block
      end

      def add_to(proxy)
        value = @block.arity == 1 ? @block.call(proxy) : proxy.instance_exec(&@block)
        if FactoryGirl::Sequence === value
          raise SequenceAbuseError
        end
        proxy.set(name, value)
      end
    end

  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
factory_girl-2.0.4 lib/factory_girl/attribute/dynamic.rb
factory_girl-2.0.3 lib/factory_girl/attribute/dynamic.rb
factory_girl-2.0.2 lib/factory_girl/attribute/dynamic.rb
factory_girl-2.0.1 lib/factory_girl/attribute/dynamic.rb
factory_girl-2.0.0.rc4 lib/factory_girl/attribute/dynamic.rb
factory_girl-2.0.0.rc3 lib/factory_girl/attribute/dynamic.rb
factory_girl-2.0.0.rc2 lib/factory_girl/attribute/dynamic.rb
factory_girl-2.0.0.rc1 lib/factory_girl/attribute/dynamic.rb
factory_girl-2.0.0.beta5 lib/factory_girl/attribute/dynamic.rb
factory_girl-2.0.0.beta4 lib/factory_girl/attribute/dynamic.rb
factory_girl-2.0.0.beta3 lib/factory_girl/attribute/dynamic.rb
factory_girl_kibiz0r-2.0.0.beta3 lib/factory_girl/attribute/dynamic.rb