Class: Shaf::Yard::LinkObject

Inherits:
YARD::CodeObjects::Base
  • Object
show all
Defined in:
lib/shaf/yard/link_object.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#curieObject

Returns the value of attribute curie.



8
9
10
# File 'lib/shaf/yard/link_object.rb', line 8

def curie
  @curie
end

#relObject

Returns the value of attribute rel.



8
9
10
# File 'lib/shaf/yard/link_object.rb', line 8

def rel
  @rel
end

Instance Method Details

#content_typeObject



50
51
52
# File 'lib/shaf/yard/link_object.rb', line 50

def content_type
  descriptor&.content_type
end

#curie?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/shaf/yard/link_object.rb', line 10

def curie?
  !!curie
end

#descriptorObject



34
35
36
# File 'lib/shaf/yard/link_object.rb', line 34

def descriptor
  profile&.find_relation(rel)
end

#documentationObject



14
15
16
# File 'lib/shaf/yard/link_object.rb', line 14

def documentation
  profile_doc || iana_doc || 'Undocumented'
end

#hrefObject



46
47
48
# File 'lib/shaf/yard/link_object.rb', line 46

def href
  descriptor&.href
end

#http_methodsObject



42
43
44
# File 'lib/shaf/yard/link_object.rb', line 42

def http_methods
  Array(descriptor&.http_methods)
end

#iana_docObject



54
55
56
# File 'lib/shaf/yard/link_object.rb', line 54

def iana_doc
  LinkRelations.get(name)&.description
end

#profileObject



27
28
29
30
31
32
# File 'lib/shaf/yard/link_object.rb', line 27

def profile
  return @profile if defined? @profile
  return unless namespace.respond_to? :profile
  profile = namespace.profile
  @profile = profile&.find_relation(name) && profile
end

#profile_docObject



38
39
40
# File 'lib/shaf/yard/link_object.rb', line 38

def profile_doc
  descriptor&.doc
end

#profile_objectObject



18
19
20
21
22
23
24
25
# File 'lib/shaf/yard/link_object.rb', line 18

def profile_object
  return unless profile
  return unless namespace.respond_to? :profile_objects

  namespace.profile_objects.find do |po|
    po.profile == profile
  end
end