Class: Pluct::LinkDescriptionObject

Inherits:
Object
  • Object
show all
Defined in:
lib/pluct/link_description_object.rb

Instance Method Summary collapse

Constructor Details

#initialize(raw_link) ⇒ LinkDescriptionObject

Returns a new instance of LinkDescriptionObject.



3
4
5
# File 'lib/pluct/link_description_object.rb', line 3

def initialize(raw_link)
  @href = raw_link["href"]
end

Instance Method Details

#expand_href(mapping) ⇒ Object



7
8
9
# File 'lib/pluct/link_description_object.rb', line 7

def expand_href(mapping)
  template.expand(mapping).to_s
end

#unused_mapping(orig_mapping) ⇒ Object



11
12
13
14
15
16
# 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