module Rack::LinkHeaders::Helper::InstanceMethods
Public Instance Methods
link(url, params = {})
click to toggle source
Add a new Link header to response headers. Requires a URL and a params hash. Does not escape or sanitize anything. Manual added Link headers will be overridden.
# File lib/rack/link_headers/helper.rb, line 18 def link(url, params = {}) links << {url: url.to_s, params: params} self['Link'] = links.to_a.map do |link| "<#{link[:url]}>" + link[:params].keys.sort.map do |k| "; #{k}=\"#{link[:params][k]}\"" end.join end.join(', ') end
links()
click to toggle source
# File lib/rack/link_headers/helper.rb, line 28 def links @links ||= [] end