Sha256: 1b59c8e8762a0cc72a6909314285936f844f4336e42226892a2ed44f2be0abb4
Contents?: true
Size: 690 Bytes
Versions: 14
Compression:
Stored size: 690 Bytes
Contents
# frozen_string_literal: true module Sail module Types # Boolean # # The Boolean type simply returns true # or false depending on what is stored # in the database. class Boolean < Type def to_value @setting.value == Sail::ConstantCollection::TRUE end def from(value) if value.is_a?(::String) check_for_on_or_boolean(value) elsif value.nil? Sail::ConstantCollection::FALSE else value.to_s end end private def check_for_on_or_boolean(value) value == Sail::ConstantCollection::ON ? Sail::ConstantCollection::TRUE : value end end end end
Version data entries
14 entries across 14 versions & 1 rubygems