Module: Waw::ActionController::ActionUtils
- Included in:
- Waw::ActionController, Waw::ActionController
- Defined in:
- lib/waw/controllers/action/action_utils.rb
Overview
Common utilities about actions.
Instance Method Summary collapse
-
#extract_action_name(path) ⇒ Object
Extracts the action name from a given path.
- #find_action(name) ⇒ Object (also: #[])
-
#has_action?(name) ⇒ Boolean
Checks if an action exists.
Instance Method Details
#extract_action_name(path) ⇒ Object
Extracts the action name from a given path
9 10 11 12 |
# File 'lib/waw/controllers/action/action_utils.rb', line 9 def extract_action_name(path) return $1.to_sym if path =~ /([a-zA-Z_]+)$/ nil end |
#find_action(name) ⇒ Object Also known as: []
21 22 23 24 25 |
# File 'lib/waw/controllers/action/action_utils.rb', line 21 def find_action(name) name = extract_action_name(name) unless Symbol===name return nil unless name actions[name] end |
#has_action?(name) ⇒ Boolean
Checks if an action exists
15 16 17 18 19 |
# File 'lib/waw/controllers/action/action_utils.rb', line 15 def has_action?(name) name = extract_action_name(name) unless Symbol===name return false unless name actions.has_key?(name) end |