class Steep::Interface::Method

def ==(other)

def ==(other)
  other.is_a?(Method) &&
    other.type_name == type_name &&
    other.name == name &&
    other.types == types &&
    other.super_method == super_method &&
    other.attributes == attributes
end

def closed?

def closed?
  types.all?(&:closed?)
end

def include_in_chain?(method)

def include_in_chain?(method)
  (method.type_name == type_name &&
    method.name == name &&
    method.types == types &&
    method.attributes == attributes) ||
    super_method&.include_in_chain?(method)
end

def initialize(type_name:, name:, types:, super_method:, attributes:)

def initialize(type_name:, name:, types:, super_method:, attributes:)
  @type_name = type_name
  @name = name
  @types = types
  @super_method = super_method
  @attributes = attributes
end

def map_types

def map_types
  with_types(types.map {|type| yield type })
end

def private?

def private?
  attributes.include?(:private)
end

def subst(s)

def subst(s)
  self.class.new(
    type_name: type_name,
    name: name,
    types: types.map {|type| type.subst(s) },
    super_method: super_method&.subst(s),
    attributes: attributes
  )
end

def with_super(super_method)

def with_super(super_method)
  self.class.new(
    type_name: type_name,
    name: name,
    types: types,
    super_method: super_method,
    attributes: attributes
  )
end

def with_types(types)

def with_types(types)
  self.class.new(
    type_name: type_name,
    name: name,
    types: types,
    super_method: super_method,
    attributes: attributes
  )
end