lib/render/text/helper/boolean.rb in render-text-helper-0.1.0 vs lib/render/text/helper/boolean.rb in render-text-helper-0.2.0
- old
+ new
@@ -8,14 +8,15 @@
else
capital_letter ? 'N' : 'n'
end
end
- def to_yes_no(capital_letter: false)
+ # casting: capitalize | upcase | downcase
+ def to_yes_no(casting = :capitalize)
if self
- capital_letter ? 'YES' : 'yes'
+ 'yes'.send(casting.to_sym)
else
- capital_letter ? 'NO' : 'no'
+ 'no'.send(casting.to_sym)
end
end
end
class TrueClass