module Eddy

EDI Toolkit.

Constants

VERSION

Public Class Methods

clear_data() click to toggle source

Set `@data` to `nil` so that a new persistence_method can be set up.

@return [void]

# File lib/eddy.rb, line 61
def self.clear_data()
  @data = nil
end
config() click to toggle source

Configuration for Eddy.

@return [Eddy::Config]

# File lib/eddy.rb, line 22
def self.config()
  @config ||= Config.new
end
configure() { |config| ... } click to toggle source

Modify Eddy's current config.

@example

Eddy.configure do |config|
  config.persistence_method = :file
end

@yieldparam [Eddy::Config] config current Eddy config @return [void]

# File lib/eddy.rb, line 35
def self.configure()
  yield self.config()
end
data() click to toggle source

Persistent data used by Eddy.

@return [Eddy::Data::Persistence::Base]

# File lib/eddy.rb, line 42
def self.data
  return @data if defined?(@data) && !@data.nil?
  case Eddy.config.persistence_method
  when :memory then @data = Eddy::Data::Persistence::Memory.new()
  when :file   then raise NotImplementedError
  when :active_record
    if defined?(Rails) && defined?(Eddy::Rails)
      @data = Eddy::Data::Persistence::ActiveRecord.new()
    else
      raise Eddy::Errors::Error, "ActiveRecord persistence method can currently only be used with Ruby on Rails"
    end
  else raise Eddy::Errors::Error, "Unsupported persistence method: #{Eddy.config.persistence_method}"
  end
  return @data
end