Class: Troles::Macros::StrategyOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/trole_groups/macros/strategy_options.rb,
lib/troles/common/macros/strategy_options.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(subject_class) ⇒ StrategyOptions

Returns a new instance of StrategyOptions.



6
7
8
# File 'lib/trole_groups/macros/strategy_options.rb', line 6

def initialize subject_class
  @subject_class = subject_class
end

Instance Attribute Details

#subject_classObject (readonly)

Returns the value of attribute subject_class.



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

def subject_class
  @subject_class
end

Instance Method Details

#apply_macro(name) ⇒ Object

Parameters:

  • name (Symbol)

    of the macro to run



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

def apply_macro name
  # overrides default method that returns false
  begin 
    subject_class.send :include,  "Troles::Macros::#{strategy_name.to_s.camelize}".constantize
  rescue
  end
end