Class: Granite::Routing::Route
- Inherits:
-
Object
- Object
- Granite::Routing::Route
- Defined in:
- lib/granite/routing/route.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#action_path ⇒ Object
readonly
Returns the value of attribute action_path.
-
#projector_name ⇒ Object
readonly
Returns the value of attribute projector_name.
-
#projector_path ⇒ Object
readonly
Returns the value of attribute projector_path.
Instance Method Summary collapse
- #as ⇒ Object
-
#initialize(projector_path, path: nil, as: nil, projector_prefix: false) ⇒ Route
constructor
A new instance of Route.
- #path ⇒ Object
Constructor Details
#initialize(projector_path, path: nil, as: nil, projector_prefix: false) ⇒ Route
Returns a new instance of Route.
6 7 8 9 10 11 12 13 14 |
# File 'lib/granite/routing/route.rb', line 6 def initialize(projector_path, path: nil, as: nil, projector_prefix: false) @projector_path = projector_path @action_path, @projector_name = projector_path.split('#') @path = path @as = as @action_name = @action_path.split('/').last @action_name = "#{@projector_name}_#{@action_name}" if projector_prefix end |
Instance Attribute Details
#action_path ⇒ Object (readonly)
Returns the value of attribute action_path.
4 5 6 |
# File 'lib/granite/routing/route.rb', line 4 def action_path @action_path end |
#projector_name ⇒ Object (readonly)
Returns the value of attribute projector_name.
4 5 6 |
# File 'lib/granite/routing/route.rb', line 4 def projector_name @projector_name end |
#projector_path ⇒ Object (readonly)
Returns the value of attribute projector_path.
4 5 6 |
# File 'lib/granite/routing/route.rb', line 4 def projector_path @projector_path end |
Instance Method Details
#as ⇒ Object
20 21 22 |
# File 'lib/granite/routing/route.rb', line 20 def as @as || action_name end |
#path ⇒ Object
16 17 18 |
# File 'lib/granite/routing/route.rb', line 16 def path "#{@path || action_name}(/:projector_action)" end |