Class: Bureaucrat::Fields::ErrorHash

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

Constant Summary

Constant Summary

Constants included from Utils

Utils::ESCAPES

Instance Method Summary collapse

Methods included from Utils

#blank_value?, #conditional_escape, #escape, #flatatt, #format_string, #make_bool, #make_float, #mark_safe, #pretty_name

Instance Method Details

#as_textObject



43
44
45
46
47
# File 'lib/bureaucrat/fields.rb', line 43

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

#as_ulObject



37
38
39
40
41
# File 'lib/bureaucrat/fields.rb', line 37

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



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

def to_s
  as_ul
end