Class: ActionDispatch::Routing::RouteSet::CustomUrlHelper
- Defined in:
- actionpack/lib/action_dispatch/routing/route_set.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.
660 661 662 663 664 |
# File 'actionpack/lib/action_dispatch/routing/route_set.rb', line 660 def initialize(name, defaults, &block) @name = name @defaults = defaults @block = block end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block
658 659 660 |
# File 'actionpack/lib/action_dispatch/routing/route_set.rb', line 658 def block @block end |
#defaults ⇒ Object (readonly)
Returns the value of attribute defaults
658 659 660 |
# File 'actionpack/lib/action_dispatch/routing/route_set.rb', line 658 def defaults @defaults end |
#name ⇒ Object (readonly)
Returns the value of attribute name
658 659 660 |
# File 'actionpack/lib/action_dispatch/routing/route_set.rb', line 658 def name @name end |
Instance Method Details
#call(t, args, only_path = false) ⇒ Object
666 667 668 669 670 671 672 673 674 675 |
# File 'actionpack/lib/action_dispatch/routing/route_set.rb', line 666 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 |