Class: Class
Overview
HotCocoa extensions for the Class class.
Instance Method Summary collapse
-
#hotcocoa_mappers ⇒ Array<HotCocoa::Mappings::Mapper>
Returns the list of relevant HotCocoa mappers for the given class.
Instance Method Details
#hotcocoa_mappers ⇒ Array<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).
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 |