Class: Dobro::Resource

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reference, options = {}) ⇒ Resource

Returns a new instance of Resource.



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

def initialize(reference, options = {})
  @reference, @options = reference, options
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



2
3
4
# File 'lib/dobro/resource.rb', line 2

def options
  @options
end

#referenceObject

Returns the value of attribute reference.



2
3
4
# File 'lib/dobro/resource.rb', line 2

def reference
  @reference
end

Instance Method Details

#index_routeObject



8
9
10
# File 'lib/dobro/resource.rb', line 8

def index_route
  [namespace, reference].compact
end

#route_for(action, object = nil) ⇒ Object



12
13
14
15
# File 'lib/dobro/resource.rb', line 12

def route_for(action, object = nil)
  action, object = nil, action if object.nil?
  [action, namespace, object].compact
end