Class: View::Boolean
- Inherits:
-
Formatter
- Object
- Formatter
- View::Boolean
- Defined in:
- lib/view/formatters/boolean.rb
Overview
The default formatter for booleans.
It will display "Yes" or "No".
You can configure it with I18n. When writing 'true' and 'false' as keys in yaml, please don't forget the quotes.
Instance Attribute Summary
Attributes inherited from Formatter
Instance Method Summary (collapse)
Methods inherited from Formatter
#all_options, as, #format!, inherited, #options, skip_blank_formatter, #to_s, type
Instance Method Details
- (Object) boolean_value
29 30 31 |
# File 'lib/view/formatters/boolean.rb', line 29 def boolean_value !!value end |
- (Object) default
25 26 27 |
# File 'lib/view/formatters/boolean.rb', line 25 def default boolean_value ? "Yes" : "No" end |
- (Object) format
21 22 23 |
# File 'lib/view/formatters/boolean.rb', line 21 def format ::I18n.t(boolean_value.to_s, :scope => [:view, :booleans], :default => default) end |