Class: TentClient::LinkHeader

Inherits:
Object
  • Object
show all
Defined in:
lib/tent-client/link_header.rb

Defined Under Namespace

Classes: Link

Constant Summary collapse

MalformedLinkHeader =
Class.new(StandardError)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(links) ⇒ LinkHeader

Returns a new instance of LinkHeader.



14
15
16
# File 'lib/tent-client/link_header.rb', line 14

def initialize(links)
  @links = Array(links)
end

Instance Attribute Details

Returns the value of attribute links.



6
7
8
# File 'lib/tent-client/link_header.rb', line 6

def links
  @links
end

Class Method Details

.parse(header) ⇒ Object



10
11
12
# File 'lib/tent-client/link_header.rb', line 10

def self.parse(header)
  new header.split(',').map { |l| Link.parse(l) }
end

Instance Method Details

#to_sObject



18
19
20
# File 'lib/tent-client/link_header.rb', line 18

def to_s
  links.map(&:to_s).join(', ')
end