Class: FlexibleAccessibility::ApplicationResource
- Inherits:
-
Object
- Object
- FlexibleAccessibility::ApplicationResource
- Defined in:
- lib/flexible_accessibility/resource.rb
Instance Attribute Summary collapse
-
#controller ⇒ Object
readonly
Returns the value of attribute controller.
-
#namespace ⇒ Object
readonly
Returns the value of attribute namespace.
Instance Method Summary collapse
-
#initialize(resource_string) ⇒ ApplicationResource
constructor
A new instance of ApplicationResource.
- #is_standard_resource? ⇒ Boolean
- #klass ⇒ Object
Constructor Details
#initialize(resource_string) ⇒ ApplicationResource
Returns a new instance of ApplicationResource.
6 7 8 9 |
# File 'lib/flexible_accessibility/resource.rb', line 6 def initialize(resource_string) @controller = resource_string.split('/').last @namespace = resource_string.split('/').first == @controller ? 'default' : resource_string.split('/').first end |
Instance Attribute Details
#controller ⇒ Object (readonly)
Returns the value of attribute controller.
3 4 5 |
# File 'lib/flexible_accessibility/resource.rb', line 3 def controller @controller end |
#namespace ⇒ Object (readonly)
Returns the value of attribute namespace.
4 5 6 |
# File 'lib/flexible_accessibility/resource.rb', line 4 def namespace @namespace end |
Instance Method Details
#is_standard_resource? ⇒ Boolean
19 20 21 |
# File 'lib/flexible_accessibility/resource.rb', line 19 def is_standard_resource? @namespace == 'default' end |
#klass ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/flexible_accessibility/resource.rb', line 11 def klass if self.is_standard_resource? @controller.camelize.constantize else (@namespace.camelize + '::' + @controller.camelize).constantize end end |