Sha256: a9790edefe940cc4152f2b77181d173afe0790c1face28e7dfa36ba4fd5b7d29
Contents?: true
Size: 1.17 KB
Versions: 2
Compression:
Stored size: 1.17 KB
Contents
module Jazzy module SymbolGraph # A Relationship is a tidied-up SymbolGraph JSON object class Relationship attr_accessor :kind attr_accessor :source_usr attr_accessor :target_usr attr_accessor :target_fallback # can be nil attr_accessor :constraints # array, can be empty KINDS = %w[memberOf conformsTo defaultImplementationOf overrides inheritsFrom requirementOf optionalRequirementOf].freeze def protocol_requirement? %i[requirementOf optionalRequirementOf].include? kind end def default_implementation? kind == :defaultImplementationOf end def initialize(hash) kind = hash[:kind] unless KINDS.include?(kind) raise "Unknown relationship kind '#{kind}'" end self.kind = kind.to_sym self.source_usr = hash[:source] self.target_usr = hash[:target] if fallback = hash[:targetFallback] # Strip the leading module name self.target_fallback = fallback.sub(/^.*?\./, '') end self.constraints = Constraint.new_list(hash[:swiftConstraints] || []) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
jazzy-0.13.7 | lib/jazzy/symbol_graph/relationship.rb |
jazzy-0.13.6 | lib/jazzy/symbol_graph/relationship.rb |