Object
# File rbs-2.1.0/lib/rbs/definition.rb, line 79 def initialize(super_method,, defs,, accessibility,, annotations: [], alias_of)) @super_method = super_method @defs = defs @accessibility = accessibility @extra_annotations = annotations @alias_of = alias_of end
# File rbs-2.1.0/lib/rbs/definition.rb, line 87 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
# File rbs-2.1.0/lib/rbs/definition.rb, line 124 def annotations @annotations ||= @extra_annotations + defs.flat_map {|d| d.annotations } end
# File rbs-2.1.0/lib/rbs/definition.rb, line 102 def defined_in @defined_in ||= begin last_def = defs.last or raise last_def.defined_in end end
# File rbs-2.1.0/lib/rbs/definition.rb, line 98 def hash self.class.hash ^ super_method.hash ^ defs.hash ^ accessibility.hash ^ annotations.hash ^ alias_of.hash end
# File rbs-2.1.0/lib/rbs/definition.rb, line 109 def implemented_in @implemented_in ||= begin last_def = defs.last or raise last_def.implemented_in end end
# File rbs-2.1.0/lib/rbs/definition.rb, line 167 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
# File rbs-2.1.0/lib/rbs/definition.rb, line 149 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
# File rbs-2.1.0/lib/rbs/definition.rb, line 158 def map_type_bound(&block) self.class.new( super_method: super_method&.map_type_bound(&block), defs: defs.map {|defn| defn.update(type: defn.type.map_type_bound(&block)) }, accessibility: @accessibility, alias_of: alias_of ) end
# File rbs-2.1.0/lib/rbs/definition.rb, line 128 def members @members ||= defs.map(&:member).uniq end
# File rbs-2.1.0/lib/rbs/definition.rb, line 116 def method_types @method_types ||= defs.map(&:type) end
# File rbs-2.1.0/lib/rbs/definition.rb, line 136 def private? @accessibility == :private end