Class: Bureaucrat::Fields::ErrorList

Inherits:
Array
  • 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



25
26
27
# File 'lib/bureaucrat/fields.rb', line 25

def as_text
  empty? ? '' : map{|e| '* %s' % e}.join("\n")
end

#as_ulObject



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/bureaucrat/fields.rb', line 13

def as_ul
  if empty?
    ''
  else
    ul = '<ul class="errorlist">%s</ul>'
    li = '<li>%s</li>'

    result = ul % map{|e| li % conditional_escape(e)}.join("\n")
    mark_safe(result)
  end
end

#to_sObject



9
10
11
# File 'lib/bureaucrat/fields.rb', line 9

def to_s
  as_ul
end