Class: Hyperclient::Curie Private
- Inherits:
-
Object
- Object
- Hyperclient::Curie
- Defined in:
- lib/hyperclient/curie.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Curies are named tokens that you can define in the document and use to express curie relation URIs in a friendlier, more compact fashion.
Instance Method Summary collapse
-
#expand(rel) ⇒ Object
Expands the Curie when is templated with the given variables.
-
#href ⇒ Object
Returns the href property of the Curie.
-
#initialize(curie_hash, entry_point) ⇒ Curie
constructor
Initializes a new Curie.
- #inspect ⇒ Object private
-
#name ⇒ Object
Returns the name property of the Curie.
-
#templated? ⇒ Boolean
Indicates if the curie is an URITemplate or a regular URI.
Constructor Details
#initialize(curie_hash, entry_point) ⇒ Curie
Initializes a new Curie.
12 13 14 15 |
# File 'lib/hyperclient/curie.rb', line 12 def initialize(curie_hash, entry_point) @curie_hash = curie_hash @entry_point = entry_point end |
Instance Method Details
#expand(rel) ⇒ Object
Expands the Curie when is templated with the given variables.
44 45 46 47 |
# File 'lib/hyperclient/curie.rb', line 44 def (rel) return rel unless rel && templated? href.gsub('{rel}', rel) if href end |
#href ⇒ Object
Returns the href property of the Curie.
31 32 33 |
# File 'lib/hyperclient/curie.rb', line 31 def href @curie_hash['href'] end |
#inspect ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
35 36 37 |
# File 'lib/hyperclient/curie.rb', line 35 def inspect "#<#{self.class.name} #{@curie_hash}>" end |
#name ⇒ Object
Returns the name property of the Curie.
26 27 28 |
# File 'lib/hyperclient/curie.rb', line 26 def name @curie_hash['name'] end |
#templated? ⇒ Boolean
Indicates if the curie is an URITemplate or a regular URI.
21 22 23 |
# File 'lib/hyperclient/curie.rb', line 21 def templated? !!@curie_hash['templated'] end |