Class: DefResource::Interface

Inherits:
Object
  • Object
show all
Defined in:
lib/def_resource/interface.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(controller) ⇒ Interface

Returns a new instance of Interface.



5
6
7
# File 'lib/def_resource/interface.rb', line 5

def initialize controller
  @controller = controller
end

Instance Attribute Details

#controllerObject (readonly)

Returns the value of attribute controller.



3
4
5
# File 'lib/def_resource/interface.rb', line 3

def controller
  @controller
end

Instance Method Details

#configObject



13
14
15
# File 'lib/def_resource/interface.rb', line 13

def config
  controller.class.def_resource_config
end

#modelObject



9
10
11
# File 'lib/def_resource/interface.rb', line 9

def model
  config.model || default_model
end

#param_keyObject



25
26
27
# File 'lib/def_resource/interface.rb', line 25

def param_key
  model.model_name.param_key
end

#resourceObject



17
18
19
# File 'lib/def_resource/interface.rb', line 17

def resource
  config.resource || find_resource
end

#resourcesObject



21
22
23
# File 'lib/def_resource/interface.rb', line 21

def resources
  find_resources
end