Sha256: 563a53d1281f932608ea9288b8c6e63c4082caba24bad4a28aeca21cfe151e88
Contents?: true
Size: 592 Bytes
Versions: 7
Compression:
Stored size: 592 Bytes
Contents
module PR module Fields class BooleanField TrueValues = [1,"1","true",true] FalseValues = [0,"0","false",false, ""] def initialize value = nil, options = {} @value, @options = value, options end attr_reader :options def populate value @value = value end def raw convert end def convert if TrueValues.include? @value return true elsif FalseValues.include? @value return false else @value ? true : false end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems