Sha256: de51288f2e5a4b5d57b876967003856e94de6aee53a7d561c5af41459c961427

Contents?: true

Size: 962 Bytes

Versions: 4

Compression:

Stored size: 962 Bytes

Contents

require "eddy/data/store"
require "eddy/data/persistence/base"
require "eddy/data/persistence/memory"

module Eddy
  # Code for storing & generating data used by Eddy when generating EDI documents.
  module Data
    # Return a new, unique number.
    #
    # @return [Integer]
    def self.new_interchange_control_number
      existing = Eddy.data.interchange_control_numbers()
      new_ctrl_num = Eddy::Util.new_number(existing)
      Eddy.data.add_interchange_control_number(new_ctrl_num)
      return new_ctrl_num
    end

    # Return a new, unique number.
    #
    # @param transaction_set_id [String]
    # @return [Integer]
    def self.new_transaction_set_control_number(transaction_set_id)
      existing = Eddy.data.transaction_set_control_numbers(transaction_set_id)
      new_ctrl_num = Eddy::Util.new_number(existing)
      Eddy.data.add_transaction_set_control_number(transaction_set_id, new_ctrl_num)
      return new_ctrl_num
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
eddy-0.10.0 lib/eddy/data.rb
eddy-0.9.2 lib/eddy/data.rb
eddy-0.9.1 lib/eddy/data.rb
eddy-0.9.0 lib/eddy/data.rb