Class: Aspera::LinkHeader::Link
- Inherits:
-
Object
- Object
- Aspera::LinkHeader::Link
- Defined in:
- lib/aspera/link_header.rb
Overview
A single link entry: one URI and its attribute pairs.
Instance Attribute Summary collapse
-
#attr_pairs ⇒ Object
readonly
Returns the value of attribute attr_pairs.
-
#href ⇒ Object
readonly
Returns the value of attribute href.
Instance Method Summary collapse
-
#[](key) ⇒ Object
Retrieve an attribute value by name, case-insensitively.
-
#initialize(href, attr_pairs) ⇒ Link
constructor
A new instance of Link.
Constructor Details
#initialize(href, attr_pairs) ⇒ Link
Returns a new instance of Link.
16 17 18 19 |
# File 'lib/aspera/link_header.rb', line 16 def initialize(href, attr_pairs) @href = href @attr_pairs = attr_pairs end |
Instance Attribute Details
#attr_pairs ⇒ Object (readonly)
Returns the value of attribute attr_pairs.
14 15 16 |
# File 'lib/aspera/link_header.rb', line 14 def attr_pairs @attr_pairs end |
#href ⇒ Object (readonly)
Returns the value of attribute href.
14 15 16 |
# File 'lib/aspera/link_header.rb', line 14 def href @href end |
Instance Method Details
#[](key) ⇒ Object
Retrieve an attribute value by name, case-insensitively.
22 23 24 25 |
# File 'lib/aspera/link_header.rb', line 22 def [](key) pair = @attr_pairs.detect { |k, _v| k.casecmp?(key) } pair&.last end |