Sha256: d08ad403b5b46f6eb96e8cc2a7da6a5266f133612fdec35023812a1c3e1eb7a2
Contents?: true
Size: 644 Bytes
Versions: 1
Compression:
Stored size: 644 Bytes
Contents
require 'captain_config/models/base_config' class CaptainConfig::BooleanConfig < CaptainConfig::BaseConfig def value case self.text when 'true' true when 'false' false else raise "Invalid text: #{text.inspect}" end end def value=(new_value) if new_value != true && new_value != false raise ArgumentError.new("Invalid value: #{new_value.inspect}") end self.text = new_value.to_s end def self.coerce(value) case value when 'true' true when 'false' false else raise ArgumentError.new("Cannot coerce value: #{value.inspect}") end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
captain_config-1.0.0 | lib/captain_config/models/boolean_config.rb |