class Pluct::LinkDescriptionObject

Public Class Methods

new(raw_link) click to toggle source
# File lib/pluct/link_description_object.rb, line 3
def initialize(raw_link)
  @href = raw_link["href"]
end

Public Instance Methods

expand_href(mapping) click to toggle source
# File lib/pluct/link_description_object.rb, line 7
def expand_href(mapping)
  template.expand(mapping).to_s
end
unused_mapping(orig_mapping) click to toggle source
# File lib/pluct/link_description_object.rb, line 11
def unused_mapping(orig_mapping)
  mapping = orig_mapping.dup
  expanded_href = self.expand_href(mapping)
  used_mapping = template.extract(expanded_href)
  mapping.delete_if { |key, value| used_mapping.include?(key.to_s) }
end

Private Instance Methods

template() click to toggle source
# File lib/pluct/link_description_object.rb, line 20
def template
  @template ||= Addressable::Template.new(@href)
end