Sha256: 827c96d4d8f742674d88de23e316ebff4b20e2d973be0a7d7ac4458e3dce1bd8
Contents?: true
Size: 766 Bytes
Versions: 1
Compression:
Stored size: 766 Bytes
Contents
require 'singleton' require_relative 'feature_domain' require_relative 'boolean_value' module Zenlish module Feature class BooleanDomain < FeatureDomain include Singleton # Use the Singleton design patttern def build_value(aValue) BooleanValue.new(validated_value(aValue)) end def include?(aValue) aValue.kind_of?(TrueClass) || aValue.kind_of?(FalseClass) end def to_a [false, true] end private def validated_value(aValue) if not aValue.is_a?(FalseClass) and not aValue.is_a?(TrueClass) raise StandardError, "Expected a boolean instead of #{aValue.class}." end aValue end end # class end # module end # module
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
zenlish-0.2.05 | lib/zenlish/feature/boolean_domain.rb |