Module: DynamicModel::ManagedDomains

Defined in:
lib/database_introspection/dynamic_model/managed_domains.rb

Overview

Namespace for domains

Class Method Summary collapse

Class Method Details

.domain_module(table_prefix) ⇒ Object



19
20
21
# File 'lib/database_introspection/dynamic_model/managed_domains.rb', line 19

def self.domain_module(table_prefix)
  Hash[domain_prefixes.zip domain_modules][table_prefix]
end

.domain_modulesObject



7
8
9
# File 'lib/database_introspection/dynamic_model/managed_domains.rb', line 7

def self.domain_modules
  constants.map {|c| "#{self.name}::#{c.to_s}".constantize}
end

.domain_prefixesObject



3
4
5
# File 'lib/database_introspection/dynamic_model/managed_domains.rb', line 3

def self.domain_prefixes
  constants.map {|c| c.to_s.underscore}
end

.tablesObject



15
16
17
# File 'lib/database_introspection/dynamic_model/managed_domains.rb', line 15

def self.tables
  self.domain_modules.map {|mod| mod.table_names}.flatten
end

.to_hashObject



11
12
13
# File 'lib/database_introspection/dynamic_model/managed_domains.rb', line 11

def self.to_hash
  Hash[domain_modules.zip domain_prefixes]
end