class Arbre::HTML::Attributes

Public Instance Methods

any?() click to toggle source
Calls superclass method
# File lib/arbre/html/attributes.rb, line 13
def any?
  super{ |k,v| !value_empty?(v) }
end
to_s() click to toggle source
# File lib/arbre/html/attributes.rb, line 6
def to_s
  map do |name, value|
    next if value_empty?(value)
    "#{html_escape(name)}=\"#{html_escape(value)}\""
  end.compact.join ' '
end

Protected Instance Methods

html_escape(s) click to toggle source
# File lib/arbre/html/attributes.rb, line 23
def html_escape(s)
  ERB::Util.html_escape(s)
end
value_empty?(value) click to toggle source
# File lib/arbre/html/attributes.rb, line 19
def value_empty?(value)
  value.respond_to?(:empty?) ? value.empty? : !value
end