Sha256: 9fef508542d4866cd79e5a6c2f1627db72cc900246e99d10d5439189ce25f625
Contents?: true
Size: 403 Bytes
Versions: 6
Compression:
Stored size: 403 Bytes
Contents
require 'jschematic/element' module Jschematic module Attributes class Enum include Jschematic::Element def initialize(enum) raise "Enum requires an Array of possible values" unless Array === enum @enum = enum end def accepts?(instance) @enum.any?{ |e| e == instance } || fail_validation!("one of #{@enum}", instance) end end end end
Version data entries
6 entries across 6 versions & 1 rubygems