123456789_123456789_123456789_123456789_123456789_

Class: ActionDispatch::Routing::RouteSet::CustomUrlHelper

Do not use. This class is for internal use only.
Relationships & Source Files
Inherits: Object
Defined in: actionpack/lib/action_dispatch/routing/route_set.rb

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(name, defaults, &block) ⇒ CustomUrlHelper

[ GitHub ]

  
# 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 (readonly)

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/routing/route_set.rb', line 658

attr_reader :name, :defaults, :block

#defaults (readonly)

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/routing/route_set.rb', line 658

attr_reader :name, :defaults, :block

#name (readonly)

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/routing/route_set.rb', line 658

attr_reader :name, :defaults, :block

Instance Method Details

#call(t, args, only_path = false)

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/routing/route_set.rb', line 666

def call(t, args, only_path = false)
  options = args.extract_options!
  url = t.full_url_for(eval_block(t, args, options))

  if only_path
    "/" + url.partition(%r{(?<!/)/(?!/)}).last
  else
    url
  end
end

#eval_block(t, args, options) (private)

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/routing/route_set.rb', line 678

def eval_block(t, args, options)
  t.instance_exec(*args, merge_defaults(options), &block)
end

#merge_defaults(options) (private)

[ GitHub ]

  
# File 'actionpack/lib/action_dispatch/routing/route_set.rb', line 682

def merge_defaults(options)
  defaults ? defaults.merge(options) : options
end