Sha256: 3d4e608e241a8f5cb21bb3e46bf228d8b4ef7c91c4ab0652c749270a8716fae7
Contents?: true
Size: 801 Bytes
Versions: 59
Compression:
Stored size: 801 Bytes
Contents
module Steep module Subtyping class Relation attr_reader :sub_type attr_reader :super_type def initialize(sub_type:, super_type:) @sub_type = sub_type @super_type = super_type end def hash self.class.hash ^ sub_type.hash ^ super_type.hash end def ==(other) other.is_a?(self.class) && other.sub_type == sub_type && other.super_type == super_type end alias eql? == def to_s "#{sub_type} <: #{super_type}" end def map self.class.new( sub_type: yield(sub_type), super_type: yield(super_type) ) end def flip self.class.new( sub_type: super_type, super_type: sub_type ) end end end end
Version data entries
59 entries across 59 versions & 1 rubygems