Class: ActionDispatch::Routing::DirectRoutes::RouteSet::CustomUrlHelper
- Inherits:
-
Object
- Object
- ActionDispatch::Routing::DirectRoutes::RouteSet::CustomUrlHelper
- Defined in:
- lib/action_dispatch/routing/direct_routes/route_set/custom_url_helper.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#defaults ⇒ Object
readonly
Returns the value of attribute defaults.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #call(t, args, only_path = false) ⇒ Object
-
#initialize(name, defaults, &block) ⇒ CustomUrlHelper
constructor
A new instance of CustomUrlHelper.
Constructor Details
#initialize(name, defaults, &block) ⇒ CustomUrlHelper
Returns a new instance of CustomUrlHelper.
10 11 12 13 14 |
# File 'lib/action_dispatch/routing/direct_routes/route_set/custom_url_helper.rb', line 10 def initialize(name, defaults, &block) @name = name @defaults = defaults @block = block end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
8 9 10 |
# File 'lib/action_dispatch/routing/direct_routes/route_set/custom_url_helper.rb', line 8 def block @block end |
#defaults ⇒ Object (readonly)
Returns the value of attribute defaults.
8 9 10 |
# File 'lib/action_dispatch/routing/direct_routes/route_set/custom_url_helper.rb', line 8 def defaults @defaults end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/action_dispatch/routing/direct_routes/route_set/custom_url_helper.rb', line 8 def name @name end |
Instance Method Details
#call(t, args, only_path = false) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/action_dispatch/routing/direct_routes/route_set/custom_url_helper.rb', line 16 def call(t, args, only_path = false) = args. url = t.full_url_for(eval_block(t, args, )) if only_path "/" + url.partition(%r{(?<!/)/(?!/)}).last else url end end |