Module: Interjectable::InstanceMethods

Defined in:
lib/interjectable.rb

Instance Method Summary collapse

Instance Method Details

#injected_methods(include_super = true) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/interjectable.rb', line 19

def injected_methods(include_super = true)
  injected = self.class.instance_variable_get(:@injected_methods).to_a +
    self.class.instance_variable_get(:@static_injected_methods).to_a

  if include_super
    super_injected = self.class.ancestors.flat_map do |klass|
      klass.instance_variable_get(:@injected_methods).to_a +
        klass.instance_variable_get(:@static_injected_methods).to_a
    end

    [
      :injected_methods,
      *super_injected,
      *injected,
    ].uniq
  else
    [:injected_methods, *injected]
  end
end