Class: Class

Inherits:
Object show all
Defined in:
lib/hotcocoa/core_extensions/class.rb

Overview

HotCocoa extensions for the Class class.

Instance Method Summary collapse

Instance Method Details

#hotcocoa_mappersArray<HotCocoa::Mappings::Mapper>

TODO:

Complexity is almost O(|ancestors|*|mappings|), and I don't think we can fix that without changing the data structure for caching mappers.

Returns the list of relevant HotCocoa mappers for the given class. The classes are ordered in descending order (mapper for the root class to the mapper for the parent class).

Returns:



15
16
17
18
19
20
21
22
23
# File 'lib/hotcocoa/core_extensions/class.rb', line 15

def hotcocoa_mappers
  mappers = HotCocoa::Mappings.mappings.values
  ret     = ancestors.reverse!
  ret.map! { |ancestor|
    mappers.find { |mapper| mapper.control_class == ancestor }
  }
  ret.compact!
  ret
end