Class: SentrySummary::Link
- Inherits:
-
Object
- Object
- SentrySummary::Link
- Defined in:
- lib/sentry-summary/sentry.rb
Instance Attribute Summary collapse
-
#cursor ⇒ Object
readonly
Returns the value of attribute cursor.
-
#rel ⇒ Object
readonly
Returns the value of attribute rel.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(rel, cursor, results) ⇒ Link
constructor
A new instance of Link.
- #results? ⇒ Boolean
Constructor Details
#initialize(rel, cursor, results) ⇒ Link
Returns a new instance of Link.
95 96 97 98 99 |
# File 'lib/sentry-summary/sentry.rb', line 95 def initialize(rel, cursor, results) @rel = rel.to_sym @cursor = cursor @results = results end |
Instance Attribute Details
#cursor ⇒ Object (readonly)
Returns the value of attribute cursor.
93 94 95 |
# File 'lib/sentry-summary/sentry.rb', line 93 def cursor @cursor end |
#rel ⇒ Object (readonly)
Returns the value of attribute rel.
93 94 95 |
# File 'lib/sentry-summary/sentry.rb', line 93 def rel @rel end |
Class Method Details
.build(link) ⇒ Object
105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/sentry-summary/sentry.rb', line 105 def self.build(link) match = link.strip.match(/^<[^>]+>\s*((?:;\s*(?:[^;]+))*)$/) parameters = match[1] parameters = parameters.scan(/;\s*([^;]+)/).map(&:first) parameters = parameters.map do |parameter| parameter.scan(/^([^=]+)="([^"]+)"$/).first end.to_h Link.new(parameters["rel"], parameters["cursor"], parameters["results"]) end |
Instance Method Details
#results? ⇒ Boolean
101 102 103 |
# File 'lib/sentry-summary/sentry.rb', line 101 def results? @results == "true" end |