Class: FalseClass

Inherits:
Object show all
Defined in:
lib/corelib/boolean/false.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.format_to_yes_no(value, options) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/corelib/boolean/false.rb', line 9

def self.format_to_yes_no(value, options)
  return value if !options.has_key?(:format) #If format is unspecified, use the default
  format = options[:format]
  return value.upcase if format == "Up"
  return value.downcase if format == "Down"
  value.capitalize   #format has to be capital at this point (or an invalid format, so we will assume capital)
end

Instance Method Details

#to_yes_no(options = {}) ⇒ Object

Cap, Down, Up



4
5
6
7
# File 'lib/corelib/boolean/false.rb', line 4

def to_yes_no(options={})
   value = options.fetch(:if_no, "No")
   FalseClass.format_to_yes_no(value, options)
end