class GenericViewMapper::RegistryMatcher
Attributes
registry[R]
Public Class Methods
new(registry)
click to toggle source
# File lib/generic_view_mapper/registry_matcher.rb, line 5 def initialize(registry) @registry = registry end
Public Instance Methods
find_entity_for(data)
click to toggle source
# File lib/generic_view_mapper/registry_matcher.rb, line 9 def find_entity_for(data) get_list_for(:entities) .find { |x| x.applicable?(data) } end
find_view_for(entity)
click to toggle source
# File lib/generic_view_mapper/registry_matcher.rb, line 14 def find_view_for(entity) get_list_for(:views) .find { |x| x.applies_to?(entity) } end
Private Instance Methods
get_list_for(key)
click to toggle source
# File lib/generic_view_mapper/registry_matcher.rb, line 19 def get_list_for(key) registry[key] .sort { |a,b| b.last <=> a.last } .map { |x| x.first } end