Class: Bureaucrat::Fields::ErrorHash

Inherits:
Hash
  • Object
show all
Includes:
Utils
Defined in:
lib/bureaucrat/fields.rb

Constant Summary

Constants included from Utils

Utils::ESCAPES

Instance Method Summary collapse

Methods included from Utils

conditional_escape, escape, flatatt, format_string, make_bool, make_float, mark_safe, pretty_name, security_hash

Instance Method Details

#as_textObject



39
40
41
42
43
# File 'lib/bureaucrat/fields.rb', line 39

def as_text
  map do |k, v|
    '* %s\n%s' % [k, v.map{|i| '  * %s'}.join("\n")]
  end.join("\n")
end

#as_ulObject



33
34
35
36
37
# File 'lib/bureaucrat/fields.rb', line 33

def as_ul
  ul = '<ul class="errorlist">%s</ul>'
  li = '<li>%s%s</li>'
  empty? ? '' : mark_safe(ul % map {|k, v| li % [k, v]}.join)
end

#to_sObject



29
30
31
# File 'lib/bureaucrat/fields.rb', line 29

def to_s
  as_ul
end