class T::Types::TEnum
Validates that an object is equal to another T::Enum singleton value.
def build_type
def build_type nil end
def initialize(val)
def initialize(val) @val = val end
def name
def name # Strips the #<...> off, just leaving the ... # Reasoning: the user will have written something like # T.any(MyEnum::A, MyEnum::B) # in the type, so we should print what they wrote in errors, not: # T.any(#<MyEnum::A>, #<MyEnum::B>) @val.inspect[2..-2] end
def subtype_of_single?(other)
def subtype_of_single?(other) ther Enum == other.val e
def valid?(obj)
def valid?(obj) @val == obj end