Method: CGI::HtmlExtension#base

Defined in:
lib/cgi/html.rb

#base(href = "") ⇒ Object

Generate a Document Base URI element as a String.

href can either by a string, giving the base URL for the HREF attribute, or it can be a has of the element’s attributes.

The passed-in no-argument block is ignored.

base("http://www.example.com/cgi")
  # => "<BASE HREF=\"http://www.example.com/cgi\">"


115
116
117
118
119
120
121
122
# File 'lib/cgi/html.rb', line 115

def base(href = "") # :yield:
  attributes = if href.kind_of?(String)
                 { "HREF" => href }
               else
                 href
               end
  super(attributes)
end