Class: RouteTranslator::Route
- Inherits:
-
Object
- Object
- RouteTranslator::Route
- Defined in:
- lib/route_translator/route.rb
Instance Attribute Summary collapse
-
#mapping ⇒ Object
readonly
Returns the value of attribute mapping.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#options_constraints ⇒ Object
readonly
Returns the value of attribute options_constraints.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#route_set ⇒ Object
readonly
Returns the value of attribute route_set.
Instance Method Summary collapse
-
#initialize(route_set, path, name, options_constraints, options, mapping) ⇒ Route
constructor
A new instance of Route.
- #scope ⇒ Object
Constructor Details
#initialize(route_set, path, name, options_constraints, options, mapping) ⇒ Route
Returns a new instance of Route.
7 8 9 10 11 12 13 14 |
# File 'lib/route_translator/route.rb', line 7 def initialize(route_set, path, name, , , mapping) @route_set = route_set @path = path @name = name @options_constraints = @options = @mapping = mapping end |
Instance Attribute Details
#mapping ⇒ Object (readonly)
Returns the value of attribute mapping.
5 6 7 |
# File 'lib/route_translator/route.rb', line 5 def mapping @mapping end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/route_translator/route.rb', line 5 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/route_translator/route.rb', line 5 def @options end |
#options_constraints ⇒ Object (readonly)
Returns the value of attribute options_constraints.
5 6 7 |
# File 'lib/route_translator/route.rb', line 5 def @options_constraints end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
5 6 7 |
# File 'lib/route_translator/route.rb', line 5 def path @path end |
#route_set ⇒ Object (readonly)
Returns the value of attribute route_set.
5 6 7 |
# File 'lib/route_translator/route.rb', line 5 def route_set @route_set end |
Instance Method Details
#scope ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/route_translator/route.rb', line 16 def scope @scope ||= if mapping.defaults[:controller] %i[routes controllers].concat mapping.defaults[:controller].split('/').map(&:to_sym) else %i[routes controllers] end end |