Module: Coactive::Coactor

Extended by:
ActiveSupport::Concern
Includes:
Coactants, Coactions
Defined in:
lib/coactive/coactor.rb

Instance Method Summary collapse

Methods included from Coactions

[], []=

Instance Method Details

#coactorsObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/coactive/coactor.rb', line 14

def coactors
  self.class._coactants.map do |coactant|
    if coactant.is_a?(Symbol) && respond_to?(coactant, true)
      send(coactant)
    elsif coactant.is_a?(Proc)
      instance_exec(&coactant)
    else
      coactant
    end
  end.flatten.compact.map do |coactant|
    if coactant.is_a?(Class) && coactant < self.class.coactive_config.base_class
      coactant
    else
      self.class.coactors(coactant)
    end
  end.flatten.compact
end