Module: Horza::Entities

Defined in:
lib/horza/entities.rb,
lib/horza/entities/single.rb,
lib/horza/entities/collection.rb,
lib/horza/entities/single_with_active_model.rb

Defined Under Namespace

Classes: Collection, Single, SingleWithActiveModel

Class Method Summary collapse

Class Method Details

.collection_entitiesObject



18
19
20
# File 'lib/horza/entities.rb', line 18

def collection_entities
  @collections ||= ::Horza.descendants_map(::Horza::Entities::Collection)
end

.collection_entity_for(entity_symbol, attributes) ⇒ Object



13
14
15
16
# File 'lib/horza/entities.rb', line 13

def collection_entity_for(entity_symbol, attributes)
  klass = collection_entities[entity_symbol] || Horza.adapter.collection_entity_klass
  klass.new(attributes)
end

.single_entitiesObject



9
10
11
# File 'lib/horza/entities.rb', line 9

def single_entities
  @singles ||= ::Horza.descendants_map(::Horza::Entities::Single)
end

.single_entity_for(entity_symbol, attributes) ⇒ Object



4
5
6
7
# File 'lib/horza/entities.rb', line 4

def single_entity_for(entity_symbol, attributes)
  klass = single_entities[entity_symbol] || Horza.adapter.single_entity_klass
  klass.new(attributes)
end