Sha256: 730cbc62b35e26e9e78aadca48f4c495546cf0a917b702c1030e37d7fbeb1701
Contents?: true
Size: 921 Bytes
Versions: 3
Compression:
Stored size: 921 Bytes
Contents
module Arql class Definition def initialize ActiveRecord::Base.connection.tap do |conn| conn.tables.each do |table_name| conn.primary_key(table_name).tap do |pkey| table_name.camelize.tap do |const_name| const_name = 'Modul' if const_name == 'Module' const_name = 'Clazz' if const_name == 'Class' Class.new(ActiveRecord::Base) do self.primary_key = pkey self.table_name = table_name self.inheritance_column = nil end.tap do |clazz| Object.const_set(const_name, clazz).tap do |const| const_name.gsub(/[a-z]*/, '').tap do |abbr| Object.const_set abbr, const unless Object.const_defined?(abbr) end end end end end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
arql-0.1.2 | lib/arql/definition.rb |
arql-0.1.1 | lib/arql/definition.rb |
arql-0.1.0 | lib/arql/definition.rb |