Class: Formatters::FormatBoolean

Inherits:
Format show all
Defined in:
lib/formatters/format_boolean.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ FormatBoolean

Returns a new instance of FormatBoolean.



3
4
5
6
# File 'lib/formatters/format_boolean.rb', line 3

def initialize(options = {})
  @on = 'yes'
  @off = 'no'
end

Instance Method Details

#from(value, options = {}) ⇒ Object



8
9
10
# File 'lib/formatters/format_boolean.rb', line 8

def from(value, options = {})
	value ? @on : @off
end

#to(str, options = {}) ⇒ Object



12
13
14
# File 'lib/formatters/format_boolean.rb', line 12

def to(str, options = {})
	str == @on
end