class RBS::Annotate::Annotations::Copy
def ==(other)
def ==(other) other.is_a?(Copy) && other.annotation == annotation && other.source == source end
def hash
def hash self.class.hash ^ annotation.hash ^ source.hash end
def initialize(annotation:, source:)
def initialize(annotation:, source:) @annotation = annotation @source = source end
def method_name
def method_name _, m = partition if m m[1] end end
def partition
def partition case when match = source.match(/(?<constant_name>[^#]+)#(?<method_name>.+)/) [ TypeName.parse(match[:constant_name] || raise), [ false, (match[:method_name] or raise).to_sym ] ] when match = source.match(/(?<constant_name>[^#]+)\.(?<method_name>.+)/) [ TypeName.parse(match[:constant_name] || raise), [ true, (match[:method_name] or raise).to_sym ] ] else [ TypeName.parse(source), nil ] end end
def singleton?
def singleton? _, m = partition if m m[0] else false end end
def type_name
def type_name name, _ = partition name end