Class: Administrate::ResourceResolver
- Inherits:
-
Object
- Object
- Administrate::ResourceResolver
- Defined in:
- lib/administrate/resource_resolver.rb
Instance Method Summary collapse
- #dashboard_class ⇒ Object
-
#initialize(controller_path) ⇒ ResourceResolver
constructor
A new instance of ResourceResolver.
- #namespace ⇒ Object
- #resource_class ⇒ Object
- #resource_name ⇒ Object
- #resource_title ⇒ Object
Constructor Details
#initialize(controller_path) ⇒ ResourceResolver
Returns a new instance of ResourceResolver.
3 4 5 |
# File 'lib/administrate/resource_resolver.rb', line 3 def initialize(controller_path) @controller_path = controller_path end |
Instance Method Details
#dashboard_class ⇒ Object
7 8 9 |
# File 'lib/administrate/resource_resolver.rb', line 7 def dashboard_class ActiveSupport::Inflector.constantize("#{resource_class_name}Dashboard") end |
#namespace ⇒ Object
11 12 13 |
# File 'lib/administrate/resource_resolver.rb', line 11 def namespace controller_path.split("/").first end |
#resource_class ⇒ Object
15 16 17 |
# File 'lib/administrate/resource_resolver.rb', line 15 def resource_class ActiveSupport::Inflector.constantize(resource_class_name) end |
#resource_name ⇒ Object
19 20 21 |
# File 'lib/administrate/resource_resolver.rb', line 19 def resource_name model_path_parts.map(&:underscore).join("__").to_sym end |
#resource_title ⇒ Object
23 24 25 |
# File 'lib/administrate/resource_resolver.rb', line 23 def resource_title model_path_parts.join(" ") end |