Class: Jazzy::SymbolGraph::ExtKey

Inherits:
Object
  • Object
show all
Defined in:
lib/jazzy/symbol_graph/ext_key.rb

Overview

An ExtKey identifies an extension of a type, made up of the USR of the type and the constraints of the extension. With Swift 5.9 extension symbols, the USR is the ‘fake’ USR invented by symbolgraph to solve the same problem as this type, which means less merging takes place.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(usr, constraints) ⇒ ExtKey

Returns a new instance of ExtKey.



13
14
15
16
# File 'lib/jazzy/symbol_graph/ext_key.rb', line 13

def initialize(usr, constraints)
  self.usr = usr
  self.constraints_text = constraints.map(&:to_swift).join
end

Instance Attribute Details

#constraints_textObject

Returns the value of attribute constraints_text.



11
12
13
# File 'lib/jazzy/symbol_graph/ext_key.rb', line 11

def constraints_text
  @constraints_text
end

#usrObject

Returns the value of attribute usr.



10
11
12
# File 'lib/jazzy/symbol_graph/ext_key.rb', line 10

def usr
  @usr
end

Instance Method Details

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/jazzy/symbol_graph/ext_key.rb', line 22

def eql?(other)
  hash_key == other.hash_key
end

#hashObject



26
27
28
# File 'lib/jazzy/symbol_graph/ext_key.rb', line 26

def hash
  hash_key.hash
end

#hash_keyObject



18
19
20
# File 'lib/jazzy/symbol_graph/ext_key.rb', line 18

def hash_key
  usr + constraints_text
end