Sha256: 7b78d734bc5843c470bca053ff0e8524fced0620e1630ed5bc923632dc0126cd
Contents?: true
Size: 500 Bytes
Versions: 21
Compression:
Stored size: 500 Bytes
Contents
module Flexite class BoolEntry < Entry def value self[:value].to_i == 1 ? true : false end def form Entry::Form.new(attributes.merge(value: self[:value].to_i)) end private def check_value unless self[:value].respond_to?(:to_i) errors.add(:value, 'should respond to #to_i') return false end unless [1, 0].include?(self[:value].to_i) errors.add(:value, 'not a valid boolean') false end end end end
Version data entries
21 entries across 21 versions & 1 rubygems