Sha256: a1bd5d2fdc8233bfb6ed18cbafe06e5828411cd45a8b3aba940dae626eafb6c4

Contents?: true

Size: 395 Bytes

Versions: 1

Compression:

Stored size: 395 Bytes

Contents

module TFG
  module Support
    class Sequence
      def initialize(first, generator)
        self.first = first
        self.generator = generator
      end

      def next
        if previous
          self.previous = generator.call(previous)
        else
          self.previous = first
        end
      end

      private

      attr_accessor :first, :previous, :generator
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tfg_support-1.0.0 lib/tfg/support/sequence.rb