Module: Sinatra::AssetPack::HtmlHelpers

Extended by:
HtmlHelpers
Included in:
HtmlHelpers, Package
Defined in:
lib/sinatra/assetpack/html_helpers.rb

Instance Method Summary collapse

Instance Method Details

#e(str) ⇒ Object



6
7
8
9
10
# File 'lib/sinatra/assetpack/html_helpers.rb', line 6

def e(str)
  re = Rack::Utils.escape_html str
  re = re.gsub("/", '/')  # Rack sometimes insists on munging slashes in Ruby 1.8.
  re
end

#kv(hash) ⇒ Object



12
13
14
# File 'lib/sinatra/assetpack/html_helpers.rb', line 12

def kv(hash)
  hash.map { |k, v| " #{e k}='#{e v}'" }.join('')
end