Class: TroleGroups::Macros::Configuration::BaseLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/trole_groups/macros/configuration/base_loader.rb

Direct Known Subclasses

ConfigLoader, StorageLoader, StrategyLoader

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(strategy, orm) ⇒ BaseLoader

Returns a new instance of BaseLoader.



6
7
8
9
# File 'lib/trole_groups/macros/configuration/base_loader.rb', line 6

def initialize strategy, orm
  @strategy = strategy
  @orm = orm || Troles::Config.default_orm
end

Instance Attribute Details

#ormObject (readonly)

Returns the value of attribute orm.



4
5
6
# File 'lib/trole_groups/macros/configuration/base_loader.rb', line 4

def orm
  @orm
end

#strategyObject (readonly)

Returns the value of attribute strategy.



4
5
6
# File 'lib/trole_groups/macros/configuration/base_loader.rb', line 4

def strategy
  @strategy
end

Instance Method Details

#base_classObject



20
21
22
# File 'lib/trole_groups/macros/configuration/base_loader.rb', line 20

def base_class
  "BaseMany"
end

#namespaceObject



24
25
26
# File 'lib/trole_groups/macros/configuration/base_loader.rb', line 24

def namespace
  'TroleGroups'
end

#orm_namespaceObject



28
29
30
31
32
# File 'lib/trole_groups/macros/configuration/base_loader.rb', line 28

def orm_namespace
  ns = namespace
  ns << "::#{orm.to_s.camelize}" if orm
  ns
end

#try_module(full_name) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/trole_groups/macros/configuration/base_loader.rb', line 11

def try_module full_name
  begin
    full_name.constantize
    true
  rescue
    false
  end
end