Module: ActionContext::InstanceMethods
- Defined in:
- lib/action_context.rb
Instance Method Summary collapse
-
#match_context(context, path) ⇒ Object
Checks the given path to see if it represents the specified context.
-
#set_context(context, matcher) ⇒ Object
Establish a connection between the current action and where we are in the current navigation context.
Instance Method Details
#match_context(context, path) ⇒ Object
Checks the given path to see if it represents the specified context
27 28 29 30 31 32 |
# File 'lib/action_context.rb', line 27 def match_context(context, path) @contexts ||= {} return false unless @contexts[context].present? return true if path =~ @contexts[context] false end |
#set_context(context, matcher) ⇒ Object
Establish a connection between the current action and where we are in the current navigation context. Accepts a context symbol (e.g. :primary) and a Regex matcher (e.g. /^/users/).
21 22 23 24 |
# File 'lib/action_context.rb', line 21 def set_context(context, matcher) @contexts ||= {} @contexts[context] = matcher end |