class Shaf::Yard::LinkObject

Attributes

curie[RW]
rel[RW]

Public Instance Methods

content_type() click to toggle source
# File lib/shaf/yard/link_object.rb, line 50
def content_type
  descriptor&.content_type
end
curie?() click to toggle source
# File lib/shaf/yard/link_object.rb, line 10
def curie?
  !!curie
end
descriptor() click to toggle source
# File lib/shaf/yard/link_object.rb, line 34
def descriptor
  profile&.find_relation(rel)
end
documentation() click to toggle source
# File lib/shaf/yard/link_object.rb, line 14
def documentation
  profile_doc || iana_doc || 'Undocumented'
end
href() click to toggle source
# File lib/shaf/yard/link_object.rb, line 46
def href
  descriptor&.href
end
http_methods() click to toggle source
# File lib/shaf/yard/link_object.rb, line 42
def http_methods
  Array(descriptor&.http_methods)
end
iana_doc() click to toggle source
# File lib/shaf/yard/link_object.rb, line 54
def iana_doc
  ApiDoc::LinkRelations.load_iana
  ApiDoc::LinkRelations[name.to_sym]&.description
end
profile() click to toggle source
# 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_doc() click to toggle source
# File lib/shaf/yard/link_object.rb, line 38
def profile_doc
  descriptor&.doc
end
profile_object() click to toggle source
# 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