Class: Administrate::Namespace::Resource
- Inherits:
-
Object
- Object
- Administrate::Namespace::Resource
- Defined in:
- lib/administrate/namespace/resource.rb
Instance Attribute Summary collapse
-
#namespace ⇒ Object
readonly
Returns the value of attribute namespace.
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
Instance Method Summary collapse
-
#initialize(namespace, resource) ⇒ Resource
constructor
A new instance of Resource.
- #name ⇒ Object
- #path ⇒ Object
- #to_s ⇒ Object
- #to_sym ⇒ Object
Constructor Details
#initialize(namespace, resource) ⇒ Resource
Returns a new instance of Resource.
6 7 8 9 |
# File 'lib/administrate/namespace/resource.rb', line 6 def initialize(namespace, resource) @namespace = namespace @resource = resource end |
Instance Attribute Details
#namespace ⇒ Object (readonly)
Returns the value of attribute namespace.
4 5 6 |
# File 'lib/administrate/namespace/resource.rb', line 4 def namespace @namespace end |
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
4 5 6 |
# File 'lib/administrate/namespace/resource.rb', line 4 def resource @resource end |
Instance Method Details
#name ⇒ Object
19 20 21 |
# File 'lib/administrate/namespace/resource.rb', line 19 def name resource.to_s.gsub(/^#{namespace}\//, "").to_sym end |
#path ⇒ Object
23 24 25 |
# File 'lib/administrate/namespace/resource.rb', line 23 def path name.to_s.tr("/", "_") end |
#to_s ⇒ Object
11 12 13 |
# File 'lib/administrate/namespace/resource.rb', line 11 def to_s name.to_s end |
#to_sym ⇒ Object
15 16 17 |
# File 'lib/administrate/namespace/resource.rb', line 15 def to_sym name end |