Class: Builtins::Helpers::Enumerator

Inherits:
Object
  • Object
show all
Defined in:
lib/builtins/helpers/enumerator.rb

Class Method Summary collapse

Class Method Details

.names_by_constantObject



10
11
12
13
14
15
16
17
18
# File 'lib/builtins/helpers/enumerator.rb', line 10

def names_by_constant
  constants_by_name.each_with_object({}) do |(name, const), hash|
    if hash.include?(const)
      hash[const] << name
    else
      hash[const] = [name]
    end
  end
end