Module: Troles::Common::Macros

Defined in:
lib/troles/common/macros.rb,
lib/troles/common/macros/configuration.rb,
lib/troles/common/macros/configuration/base_loader.rb,
lib/troles/common/macros/configuration/config_loader.rb,
lib/troles/common/macros/configuration/storage_loader.rb,
lib/troles/common/macros/configuration/strategy_loader.rb

Defined Under Namespace

Classes: Configuration

Instance Method Summary collapse

Instance Method Details

#troles_strategy(strategy, options = {}) {|troles_config| ... } ⇒ Object

Yields:

  • (troles_config)


16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/troles/common/macros.rb', line 16

def troles_strategy strategy, options = {}, &block
  configuration = Configuration.new self, strategy, options

  configuration.load_adapter
  puts "strategy module: #{configuration.strategy_module}"
  puts configuration.strategy_module.methods.grep /store/ 
  
  send :include, configuration.strategy_module

  configuration.define_hooks
  configuration.apply_strategy_options!

  if strategy == :bit_one 
    troles_config.valid_roles = [:user, :admin] # default binary roles 
  end
  
  yield troles_config if block_given?
  troles_config
end