Class: Arpa::Repositories::Profiles::Finder
- Inherits:
-
Object
- Object
- Arpa::Repositories::Profiles::Finder
- Includes:
- Base
- Defined in:
- lib/arpa/repositories/profiles/finder.rb
Instance Method Summary collapse
- #all ⇒ Object
- #all_by_entity(entity_id, entity_class) ⇒ Object
- #find(id) ⇒ Object
- #mapper_instance ⇒ Object
- #repository_class ⇒ Object
Instance Method Details
#all ⇒ Object
12 13 14 15 16 |
# File 'lib/arpa/repositories/profiles/finder.rb', line 12 def all repository_class.all.collect do |record| mapper_instance.map_to_entity(record) end end |
#all_by_entity(entity_id, entity_class) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/arpa/repositories/profiles/finder.rb', line 18 def all_by_entity(entity_id, entity_class) repository_class .where("( (entity_id is null AND entity_class is null) OR (entity_id = '#{entity_id}' AND entity_class = '#{entity_class}') )") .collect do |record| mapper_instance.map_to_entity(record) end end |
#find(id) ⇒ Object
7 8 9 10 |
# File 'lib/arpa/repositories/profiles/finder.rb', line 7 def find(id) record = repository_class.find(id) mapper_instance.map_to_entity(record) end |
#mapper_instance ⇒ Object
26 27 28 |
# File 'lib/arpa/repositories/profiles/finder.rb', line 26 def mapper_instance Arpa::DataMappers::ProfileMapper.instance end |
#repository_class ⇒ Object
30 31 32 |
# File 'lib/arpa/repositories/profiles/finder.rb', line 30 def repository_class RepositoryProfile end |