==(other)
click to toggle source
def ==(other)
other.is_a?(Method) &&
other.super_method == super_method &&
other.defs == defs &&
other.accessibility == accessibility &&
other.annotations == annotations &&
other.alias_of == alias_of
end
annotations()
click to toggle source
def annotations
@annotations ||= @extra_annotations + defs.flat_map(&:annotations)
end
defined_in()
click to toggle source
def defined_in
@defined_in ||= begin
last_def = defs.last or raise
last_def.defined_in
end
end
eql?(other)
click to toggle source
hash()
click to toggle source
def hash
self.class.hash ^ super_method.hash ^ defs.hash ^ accessibility.hash ^ annotations.hash ^ alias_of.hash
end
implemented_in()
click to toggle source
def implemented_in
@implemented_in ||= begin
last_def = defs.last or raise
last_def.implemented_in
end
end
map_method_type(&block)
click to toggle source
def map_method_type(&block)
self.class.new(
super_method: super_method,
defs: defs.map {|defn| defn.update(type: yield(defn.type)) },
accessibility: @accessibility,
alias_of: alias_of
)
end
map_type(&block)
click to toggle source
def map_type(&block)
self.class.new(
super_method: super_method&.map_type(&block),
defs: defs.map {|defn| defn.update(type: defn.type.map_type(&block)) },
accessibility: @accessibility,
alias_of: alias_of
)
end
members()
click to toggle source
def members
@members ||= defs.map(&:member).uniq
end
method_types()
click to toggle source
def method_types
@method_types ||= defs.map(&:type)
end
private?()
click to toggle source
def private?
@accessibility == :private
end
public?()
click to toggle source
def public?
@accessibility == :public
end
sub(s)
click to toggle source
def sub(s)
self.class.new(
super_method: super_method&.sub(s),
defs: defs.map {|defn| defn.update(type: defn.type.sub(s)) },
accessibility: @accessibility,
alias_of: alias_of
)
end