Sha256: a49e3bc07c5c36ca04b4bb07b429f4d1de5ecacc3c5edc7f62b7a9ceb68dacc5

Contents?: true

Size: 394 Bytes

Versions: 3

Compression:

Stored size: 394 Bytes

Contents

require 'external_includes'
require_relative 'as_class_name.rb'

def get_table sym, *args
  class_name = as_class_name sym
  class_not_defined = not(Object.const_defined? class_name)
  should_force = args.any? {|x| x == :force}
  if class_not_defined or should_force
    anon = Class.new ActiveRecord::Base
    Object.const_set class_name, anon
  else
    Object.const_get class_name
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
active_finite-0.3.2 lib/get_table.rb
active_finite-0.3.1 lib/get_table.rb
active_finite-0.2.0 lib/get_table.rb