Module: Deas::ErbTags::LinkTo::Method

Defined in:
lib/deas-erbtags/link_to.rb

Instance Method Summary collapse

Instance Method Details



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/deas-erbtags/link_to.rb', line 13

def link_to(*args, &block)
  opts, href, content = [
    args.last.kind_of?(::Hash) ? args.pop : {},
    args.pop,
    args.last
  ]
  opts.update(:href => href.to_s) if !href.nil?
  tag = opts.delete(:tag) || opts.delete('tag') || :a

  if block_given?
    capture_tag(tag, opts, &block)
  else
    tag(tag, content || href, opts)
  end
end