module EUtils

Public Class Methods

html_tag_attrs(attrs) click to toggle source
# File lib/el/utils.rb, line 12
def html_tag_attrs attrs
  attrs.inject('') do |s,kv|
    s << ' %s="%s"' % kv.map {|x| CGI.escape_html(x.to_s)}
  end
end
html_tag_requisites(escape, *args) click to toggle source
# File lib/el/utils.rb, line 2
def html_tag_requisites escape, *args
  content, attrs = nil, {}
  args.each {|a| a.is_a?(Hash) ? attrs.update(a) : content = a}
  [
    escape && content ? CGI.escape_html(content.to_s) : content,
    html_tag_attrs(attrs)
  ]
end

Private Instance Methods

html_tag_attrs(attrs) click to toggle source
# File lib/el/utils.rb, line 12
def html_tag_attrs attrs
  attrs.inject('') do |s,kv|
    s << ' %s="%s"' % kv.map {|x| CGI.escape_html(x.to_s)}
  end
end
html_tag_requisites(escape, *args) click to toggle source
# File lib/el/utils.rb, line 2
def html_tag_requisites escape, *args
  content, attrs = nil, {}
  args.each {|a| a.is_a?(Hash) ? attrs.update(a) : content = a}
  [
    escape && content ? CGI.escape_html(content.to_s) : content,
    html_tag_attrs(attrs)
  ]
end