Sha256: 95656ab5d1ea79d6af4212a05b26ff5ec218346e9c81f33a1d020eb09ec37246

Contents?: true

Size: 410 Bytes

Versions: 25

Compression:

Stored size: 410 Bytes

Contents

class Factory
  class Attribute #:nodoc:

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

      def add_to(proxy)
        value = @block.arity.zero? ? @block.call : @block.call(proxy)
        if Factory::Sequence === value
          raise SequenceAbuseError
        end
        proxy.set(name, value)
      end
    end

  end
end

Version data entries

25 entries across 25 versions & 10 rubygems

Version Path
thoughtbot-factory_girl-1.2.2 lib/factory_girl/attribute/dynamic.rb
ttilley-factory_girl-1.2.2.1 lib/factory_girl/attribute/dynamic.rb
ttilley-factory_girl-1.2.2.2 lib/factory_girl/attribute/dynamic.rb
ttilley-factory_girl-1.2.2 lib/factory_girl/attribute/dynamic.rb
vitalish-factory_girl-1.2.10 lib/factory_girl/attribute/dynamic.rb
factory_girl-1.3.3 lib/factory_girl/attribute/dynamic.rb
vitalish-factory_girl-1.2.9 lib/factory_girl/attribute/dynamic.rb
vitalish-factory_girl-1.2.8 lib/factory_girl/attribute/dynamic.rb
vitalish-factory_girl-1.2.7 lib/factory_girl/attribute/dynamic.rb
vitalish-factory_girl-1.2.6 lib/factory_girl/attribute/dynamic.rb
factory_girl-1.3.2 lib/factory_girl/attribute/dynamic.rb
factory_girl-1.3.1 lib/factory_girl/attribute/dynamic.rb
lockbox_middleware-1.2.1 vendor/gems/factory_girl-1.2.3/lib/factory_girl/attribute/dynamic.rb
factory_girl-1.3.0 lib/factory_girl/attribute/dynamic.rb
malvestuto_factory_girl-1.2.5 lib/factory_girl/attribute/dynamic.rb
factory_girl-1.2.4 lib/factory_girl/attribute/dynamic.rb
jeffrafter-factory_girl-1.2.3 lib/factory_girl/attribute/dynamic.rb
masa-iwasaki-factory_girl-1.2.3.2 lib/factory_girl/attribute/dynamic.rb
masa-iwasaki-factory_girl-1.2.3.1 lib/factory_girl/attribute/dynamic.rb
dm-factory_girl-1.2.3 lib/factory_girl/attribute/dynamic.rb