Module: VerboseTruth
- Defined in:
- lib/verbose_truth/version/version.rb,
lib/verbose_truth/verbose_truth.rb
Overview
#
require ‘verbose_truth/version/version.rb’
#
Constant Summary collapse
- VERSION =
#
VerboseTruth::VERSION
#
'1.0.12'
Class Method Summary collapse
-
.verbose_truth(i, append_dot = true) ⇒ Object
# === VerboseTruth.verbose_truth.
Instance Method Summary collapse
-
#verbose_truth(i) ⇒ Object
(also: #vt, #yes_no)
# === verbose_truth ========================================================================= #.
Class Method Details
.verbose_truth(i, append_dot = true) ⇒ Object
#
VerboseTruth.verbose_truth
With this method we can convert “true” and “false” into “Yes” and “No”, which allows us to use well-formulated english sentences. For now we include the ‘.’ character all the time.
Specific usage examples for this method:
verbose_truth(true)
verbose_truth @traditional
#
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/verbose_truth/verbose_truth.rb', line 20 def self.verbose_truth(i, append_dot = true) i = i.to_s case append_dot when :no_dot append_dot = false end case i when 'true','t','yes','ja','y','j' # nil i = 'Yes.' when 'false','f','no','nein','n' i = 'No.' else # Default since as of Oct 2014. Also includes "none" and "". i = 'No.' end # ======================================================================= # # Offer a no-dot variant as well. # ======================================================================= # unless append_dot i.chop! if i.end_with? '.' end return i end |
Instance Method Details
#verbose_truth(i) ⇒ Object Also known as: vt, yes_no
#
verbose_truth
#
46 47 48 |
# File 'lib/verbose_truth/verbose_truth.rb', line 46 def verbose_truth(i) VerboseTruth.verbose_truth(i) end |