Class: Administrate::Namespace::Resource

Inherits:
Object
  • Object
show all
Defined in:
lib/administrate/namespace/resource.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#namespaceObject (readonly)

Returns the value of attribute namespace.



4
5
6
# File 'lib/administrate/namespace/resource.rb', line 4

def namespace
  @namespace
end

#resourceObject (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

#nameObject



19
20
21
# File 'lib/administrate/namespace/resource.rb', line 19

def name
  resource.to_s.gsub(/^#{namespace}\//, "").to_sym
end

#pathObject



23
24
25
# File 'lib/administrate/namespace/resource.rb', line 23

def path
  name.to_s.tr("/", "_")
end

#to_sObject



11
12
13
# File 'lib/administrate/namespace/resource.rb', line 11

def to_s
  name.to_s
end

#to_symObject



15
16
17
# File 'lib/administrate/namespace/resource.rb', line 15

def to_sym
  name
end