class Kind::UnionType
Constants
- Interface
Attributes
inspect[R]
name[R]
Public Class Methods
new(kind)
click to toggle source
# File lib/kind/objects/union_type.rb, line 13 def initialize(kind) @kinds = Array(kind) @inspect = "(#{@kinds.map(&:name).join(' | ')})" end
Public Instance Methods
===(value)
click to toggle source
# File lib/kind/objects/union_type.rb, line 22 def ===(value) @kinds.any? { |kind| kind === value } end
|(kind)
click to toggle source
# File lib/kind/objects/union_type.rb, line 18 def |(kind) self.class.new(@kinds + [Interface[kind.nil? ? Kind::Nil : kind]]) end