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

Inherits:
Object
  • Object
show all
Defined in:
lib/action_dispatch/routing/route_set.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, defaults, &block) ⇒ CustomUrlHelper

Returns a new instance of CustomUrlHelper.



614
615
616
617
618
# File 'lib/action_dispatch/routing/route_set.rb', line 614

def initialize(name, defaults, &block)
  @name = name
  @defaults = defaults
  @block = block
end

Instance Attribute Details

#blockObject (readonly)

Returns the value of attribute block.



612
613
614
# File 'lib/action_dispatch/routing/route_set.rb', line 612

def block
  @block
end

#defaultsObject (readonly)

Returns the value of attribute defaults.



612
613
614
# File 'lib/action_dispatch/routing/route_set.rb', line 612

def defaults
  @defaults
end

#nameObject (readonly)

Returns the value of attribute name.



612
613
614
# File 'lib/action_dispatch/routing/route_set.rb', line 612

def name
  @name
end

Instance Method Details

#call(t, args, only_path = false) ⇒ Object



620
621
622
623
624
625
626
627
628
629
# File 'lib/action_dispatch/routing/route_set.rb', line 620

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