Sha256: 39f98387607b4995573fa9be231b04f1cf28e33a4836b75c6b5478247af4714d

Contents?: true

Size: 552 Bytes

Versions: 9

Compression:

Stored size: 552 Bytes

Contents

# frozen_string_literal: true

module ROM::Factory
  module Attributes
    class Sequence
      attr_reader :name, :count, :block

      def initialize(name, &block)
        @name = name
        @count = 0
        @block = block
      end

      def call(*args)
        block.call(increment, *args)
      end

      def to_proc
        method(:call).to_proc
      end

      def increment
        @count += 1
      end

      def dependency_names
        EMPTY_ARRAY
      end

      def parameters
        block.parameters
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rom-factory-0.13.0 lib/rom/factory/attributes/sequence.rb
rom-factory-0.12.0 lib/rom/factory/attributes/sequence.rb
rom-factory-0.11.0 lib/rom/factory/attributes/sequence.rb
rom-factory-0.10.2 lib/rom/factory/attributes/sequence.rb
rom-factory-0.10.1 lib/rom/factory/attributes/sequence.rb
rom-factory-0.10.0 lib/rom/factory/attributes/sequence.rb
rom-factory-0.9.1 lib/rom/factory/attributes/sequence.rb
rom-factory-0.9.0 lib/rom/factory/attributes/sequence.rb
rom-factory-0.8.0 lib/rom/factory/attributes/sequence.rb