Class: PuzzlyApiPlugin::ModulesCollection
- Inherits:
-
Collection
show all
- Includes:
- Singleton
- Defined in:
- lib/puzzly_api_plugin/collection/modules.rb
Instance Method Summary
collapse
Methods inherited from Collection
#add_metadata, #get_by_id, #identities
Methods inherited from JSONable
#copy_to_hash, #to_s
Instance Method Details
#add(document) ⇒ Object
7
8
9
10
|
# File 'lib/puzzly_api_plugin/collection/modules.rb', line 7
def add(document)
mod = Module.create(document)
add_metadata mod
end
|
#get_by_context(context) ⇒ Object
12
13
14
|
# File 'lib/puzzly_api_plugin/collection/modules.rb', line 12
def get_by_context(context)
select { |_id, mod| mod.context_id == context.id }
end
|
#get_consumers(topic) ⇒ Object
16
17
18
|
# File 'lib/puzzly_api_plugin/collection/modules.rb', line 16
def get_consumers(topic)
select { |_id, mod| mod.consumesTopics.include? topic.id }
end
|
#get_producers(topic) ⇒ Object
20
21
22
|
# File 'lib/puzzly_api_plugin/collection/modules.rb', line 20
def get_producers(topic)
select { |_id, mod| mod.producesTopics.include? topic.id }
end
|