Public Instance methods
link_to(body, href, attributes=OPTS)
Return a string with an HTML a
tag with an href
attribute. See LinkTo
module documentation for details.
[show source]
# File lib/roda/plugins/link_to.rb 58 def link_to(body, href, attributes=OPTS) 59 case href 60 when Symbol 61 href = public_send(:"#{href}_path") 62 when String 63 # nothing 64 else 65 href = path(href) 66 end 67 68 href = h(href) 69 70 body = href if body.nil? 71 72 buf = String.new << "<a href=\"#{href}\"" 73 attributes.each do |k, v| 74 buf << " " << k.to_s << "=\"" << h(v) << "\"" 75 end 76 buf << ">" << body << "</a>" 77 end