Class: HyperAdmin::ResourceCollection
- Inherits:
-
Object
- Object
- HyperAdmin::ResourceCollection
- Defined in:
- lib/hyper_admin/resource_collection.rb
Instance Attribute Summary collapse
-
#resources ⇒ Object
readonly
Returns the value of attribute resources.
Instance Method Summary collapse
- #add(resource_class) ⇒ Object
- #each(&block) ⇒ Object
-
#initialize ⇒ ResourceCollection
constructor
A new instance of ResourceCollection.
Constructor Details
#initialize ⇒ ResourceCollection
Returns a new instance of ResourceCollection.
7 8 9 |
# File 'lib/hyper_admin/resource_collection.rb', line 7 def initialize @resources = {} end |
Instance Attribute Details
#resources ⇒ Object (readonly)
Returns the value of attribute resources.
5 6 7 |
# File 'lib/hyper_admin/resource_collection.rb', line 5 def resources @resources end |
Instance Method Details
#add(resource_class) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/hyper_admin/resource_collection.rb', line 11 def add(resource_class) resource = Resource.new(resource_class) @resources[resource_class.model_name] = resource resource end |
#each(&block) ⇒ Object
18 19 20 |
# File 'lib/hyper_admin/resource_collection.rb', line 18 def each(&block) @resources.values.each(&block) end |