Class: View::Blank

Inherits:
Formatter show all
Defined in:
lib/view/formatters/blank.rb

Overview

The default formatter for blank objects, like nil, empty strings and empty arrays. It will display an empty string or something else, which you can configure with I18n.

Examples:

config/locales/en.yml

en:
  view:
    blank: "nothing"

Instance Attribute Summary

Attributes inherited from Formatter

#block, #template, #value

Instance Method Summary (collapse)

Methods inherited from Formatter

#all_options, as, #format!, inherited, #options, skip_blank_formatter, #to_s, type

Instance Method Details

- (Object) format



14
15
16
# File 'lib/view/formatters/blank.rb', line 14

def format
  ::I18n.t(:blank, :scope => :view, :default => "").html_safe
end