Sha256: 6d7beaf337953fd2c732017c2283640291d56a657f1790474d96e25724426ea3
Contents?: true
Size: 712 Bytes
Versions: 5
Compression:
Stored size: 712 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 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
5 entries across 5 versions & 1 rubygems