Module: ActiveMocker::MockCreator::ModulesConstants

Defined in:
lib/active_mocker/mock_creator/modules_constants.rb

Defined Under Namespace

Classes: Inspectable

Instance Method Summary collapse

Instance Method Details

#constantsObject



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/active_mocker/mock_creator/modules_constants.rb', line 22

def constants
  class_introspector.get_class.constants.each_with_object({}) do |v, const|
    c = class_introspector.get_class.const_get(v)
    next if [Module, Class].include?(c.class)
    if /\A#</ =~ c.inspect
      const[v] = Inspectable.new("ActiveMocker::UNREPRESENTABLE_CONST_VALUE")
    else
      const[v] = c
    end
  end
end

#modulesObject



13
14
15
16
17
18
19
20
# File 'lib/active_mocker/mock_creator/modules_constants.rb', line 13

def modules
  @modules ||= begin
    {
      included: get_module_by_reference(:included_modules),
      extended: get_module_by_reference(:extended_modules),
    }
  end
end