class String
Public Instance Methods
to_bool()
click to toggle source
Adding a to_bool
method
# File lib/mongocore/ext.rb, line 13 def to_bool return true if self =~ (/^(true|yes|t|y|[1-9]+)$/i) return false if self.empty? || self =~ (/^(false|no|n|f|0)$/i) raise ArgumentError.new %{invalid value: #{self}} end