Class: GenericViewMapper::RegistryMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/generic_view_mapper/registry_matcher.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(registry) ⇒ RegistryMatcher

Returns a new instance of RegistryMatcher.



5
6
7
# File 'lib/generic_view_mapper/registry_matcher.rb', line 5

def initialize(registry)
  @registry = registry
end

Instance Attribute Details

#registryObject (readonly)

Returns the value of attribute registry.



3
4
5
# File 'lib/generic_view_mapper/registry_matcher.rb', line 3

def registry
  @registry
end

Instance Method Details

#find_entity_for(data) ⇒ Object



9
10
11
12
# 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) ⇒ Object



14
15
16
17
# 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