Sha256: dfca9c411f4be9321bc27cd36ff35ace9475f585ff26939984e628bfef0a1cdd
Contents?: true
Size: 698 Bytes
Versions: 1
Compression:
Stored size: 698 Bytes
Contents
require_relative 'feature_domain' require_relative 'symbol_value' module Zenlish module Feature class EnumerationDomain < FeatureDomain attr_reader :enum def initialize(*symbols) @enum = symbols end def build_value(aValue) SymbolValue.new(validated_value(aValue)) end def include?(aValue) enum.include?(aValue) end def to_a enum end private def validated_value(aValue) unless include?(aValue) raise StandardError, "#{aValue} isn't part of enumeration [#{enum.join(', ')}]." 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/enumeration_domain.rb |