Class: Puffer::Controller::Action
- Inherits:
-
Object
- Object
- Puffer::Controller::Action
show all
- Defined in:
- lib/puffer/controller/actions.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(controller, *route) ⇒ Action
Returns a new instance of Action.
27
28
29
30
31
32
|
# File 'lib/puffer/controller/actions.rb', line 27
def initialize controller, *route
@controller, @route = controller, route
options = route.
@display = options.key?(:display) ? options.delete(:display) : true
route.push options
end
|
Instance Attribute Details
#controller ⇒ Object
Returns the value of attribute controller.
25
26
27
|
# File 'lib/puffer/controller/actions.rb', line 25
def controller
@controller
end
|
#route ⇒ Object
Returns the value of attribute route.
25
26
27
|
# File 'lib/puffer/controller/actions.rb', line 25
def route
@route
end
|
Instance Method Details
#action ⇒ Object
38
39
40
|
# File 'lib/puffer/controller/actions.rb', line 38
def action
@action ||= route.second.to_sym
end
|
#action_scope ⇒ Object
50
51
52
|
# File 'lib/puffer/controller/actions.rb', line 50
def action_scope
:actions
end
|
#display? ⇒ Boolean
54
55
56
|
# File 'lib/puffer/controller/actions.rb', line 54
def display?
@display
end
|
#i18n_scope ⇒ Object
46
47
48
|
# File 'lib/puffer/controller/actions.rb', line 46
def i18n_scope
[:puffer, controller.controller_path.gsub(/\//, '.'), action_scope]
end
|
#label ⇒ Object
42
43
44
|
# File 'lib/puffer/controller/actions.rb', line 42
def label
I18n.t(action, :scope => i18n_scope, :default => action.to_s.humanize)
end
|
#method ⇒ Object
34
35
36
|
# File 'lib/puffer/controller/actions.rb', line 34
def method
@method ||= route.first.to_sym
end
|