Class: Smithy::ContentResources::Registry
- Inherits:
-
Object
- Object
- Smithy::ContentResources::Registry
- Defined in:
- lib/smithy/content_resources/registry.rb
Constant Summary collapse
- @@content_resources =
[]
Class Method Summary collapse
- .clear ⇒ Object
- .content_resources ⇒ Object
- .register(content_resource_model_name, navigation_title = nil) ⇒ Object
Class Method Details
.clear ⇒ Object
9 10 11 |
# File 'lib/smithy/content_resources/registry.rb', line 9 def clear @@content_resources = [] end |
.content_resources ⇒ Object
13 14 15 |
# File 'lib/smithy/content_resources/registry.rb', line 13 def content_resources @@content_resources end |
.register(content_resource_model_name, navigation_title = nil) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/smithy/content_resources/registry.rb', line 17 def register(content_resource_model_name, =nil) return if @@content_resources.include?(content_resource_model_name) ||= content_resource_model_name.to_s.titleize.pluralize @@content_resources << [content_resource_model_name.to_s.tableize, ] Smithy::Engine.routes.prepend do scope '/smithy/content_resources' do resources content_resource_model_name.to_s.tableize end end @@content_resources end |