Sha256: e7a5ea783f9b1335258a3703336a66df59b57b8bae513d027df86fc4c717ccec
Contents?: true
Size: 745 Bytes
Versions: 3
Compression:
Stored size: 745 Bytes
Contents
module Erector module Attributes def format_attributes(attributes) if !attributes || attributes.empty? "" else format_sorted(sort_attributes(attributes)) end end def format_sorted(sorted) results = [''] sorted.each do |key, value| if value if value.is_a?(Array) value = value.flatten next if value.empty? value = value.join(' ') end results << "#{key}=\"#{h(value)}\"" end end results.join(' ') end def sort_attributes(attributes) stringized = [] attributes.each do |key, value| stringized << [key.to_s, value] end stringized.sort end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
erector-0.10.0 | lib/erector/attributes.rb |
erector-0.9.0 | lib/erector/attributes.rb |
erector-0.9.0.pre1 | lib/erector/attributes.rb |