Module: Kanpachi::APIList
- Defined in:
- lib/kanpachi/api_list.rb
Overview
Module to keep track of all APIs
Class Method Summary collapse
-
.add(api) ⇒ Hash<Kanpachi::API>
Add a resource to the list.
-
.all ⇒ Array<Kanpachi::API>
Returns an array of APIs.
-
.clear ⇒ Object
Clears all APIs.
-
.delete(name) ⇒ Object
Delete a resource to the list.
-
.find(name) ⇒ Kanpachi::API
Returns a API based on its name.
-
.to_hash ⇒ Hash<Kanpachi::API>
Returns a hash of APIs.
Class Method Details
.add(api) ⇒ Hash<Kanpachi::API>
Add a resource to the list
32 33 34 |
# File 'lib/kanpachi/api_list.rb', line 32 def add(api) @list[api.name] = api end |
.all ⇒ Array<Kanpachi::API>
Returns an array of APIs
22 23 24 |
# File 'lib/kanpachi/api_list.rb', line 22 def all @list.values end |
.clear ⇒ Object
Clears all APIs
57 58 59 |
# File 'lib/kanpachi/api_list.rb', line 57 def clear @list = {} end |
.delete(name) ⇒ Object
Delete a resource to the list
40 41 42 |
# File 'lib/kanpachi/api_list.rb', line 40 def delete(name) @list.delete(name) end |
.find(name) ⇒ Kanpachi::API
Returns a API based on its name
50 51 52 |
# File 'lib/kanpachi/api_list.rb', line 50 def find(name) @list[name] end |
.to_hash ⇒ Hash<Kanpachi::API>
Returns a hash of APIs
14 15 16 |
# File 'lib/kanpachi/api_list.rb', line 14 def to_hash @list end |