Sha256: eeeb38399739220ed71340be98448467148c784330a3a74b2763b8288394596a
Contents?: true
Size: 596 Bytes
Versions: 34
Compression:
Stored size: 596 Bytes
Contents
require 'devise' require 'bootstrap-sass' require 'font-awesome-sass-rails' require 'constructor_core/engine' class String def numeric? return true if self =~ /^\d+$/ true if Float(self) rescue false end def boolean? if self =~ (/(true|yes)$/i) || self =~ (/(false|no)$/i) return true else return false end end def to_bool return true if self == true || self =~ (/(true|t|yes|y|1)$/i) return false if self == false || self.blank? || self =~ (/(false|f|no|n|0)$/i) raise ArgumentError.new("invalid value for Boolean: \"#{self}\"") end end
Version data entries
34 entries across 34 versions & 3 rubygems