Method: Torque::PostgreSQL::AuxiliaryStatement.lookup

Defined in:
lib/torque/postgresql/auxiliary_statement.rb

.lookup(name, base) ⇒ Object

Find or create the class that will handle statement



15
16
17
18
19
20
21
22
# File 'lib/torque/postgresql/auxiliary_statement.rb', line 15

def lookup(name, base)
  const = name.to_s.camelize << '_' << self.name.demodulize
  return base.const_get(const, false) if base.const_defined?(const, false)

  base.const_set(const, Class.new(self)).tap do |klass|
    klass.instance_variable_set(:@table_name, name.to_s)
  end
end