Sha256: c3d818ff39754ae025cf353ca43422fd46813a8c00958174896fbbaf84fa7517

Contents?: true

Size: 1.03 KB

Versions: 4

Compression:

Stored size: 1.03 KB

Contents

module Coupler
  module Models
    # NOTE: using autoload here would undoubtedly be more efficient, but
    # I need to make sure the database connection is instantiated before
    # loading these classes because of how Sequel::Model works.
    #%w{connection project resource field transformer transformation scenario matcher job result comparison}.each do |name|
      #autoload(name.capitalize.to_sym, File.dirname(__FILE__) + "/models/#{name}")
    #end

    NAMES = [
      :Connection, :Project, :Resource, :Field, :Transformer,
      :Transformation, :Scenario, :Matcher, :Job, :Result, :Comparison,
      :Import
    ]
    def self.const_missing(name)
      name = name.to_sym
      if NAMES.include?(name)
        Database.instance
        require File.dirname(__FILE__) + "/models/#{name.to_s.downcase}"
        const_get(name)
      else
        puts "#{name.inspect} wasn't in #{NAMES.inspect}"
        super
      end
    end
  end
end

require File.dirname(__FILE__) + "/models/common_model"
require File.dirname(__FILE__) + "/models/jobify"

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
coupler-0.0.4-java lib/coupler/models.rb
coupler-0.0.3-java lib/coupler/models.rb
coupler-0.0.2-java lib/coupler/models.rb
coupler-0.0.1-java lib/coupler/models.rb