Class: RFC::Web::Link::Parsers::List
- Inherits:
-
Object
- Object
- RFC::Web::Link::Parsers::List
- Defined in:
- lib/rfc/web/link/parsers/list.rb
Overview
Parses header links into a list of records.
Constant Summary collapse
- RELATION_PATTERN =
/ (?<prefix>rel=") # Prefix. .+ # One or more characters. \s+? # One or more spaces, lazy. .+ # One or more characters. (?<suffix>") # Suffix. /x
Instance Method Summary collapse
- #call(text, root_uri:) ⇒ Object
-
#initialize(relation_pattern: RELATION_PATTERN, line: Line.new, list: Models::List.new) ⇒ List
constructor
A new instance of List.
Constructor Details
#initialize(relation_pattern: RELATION_PATTERN, line: Line.new, list: Models::List.new) ⇒ List
Returns a new instance of List.
19 20 21 22 23 24 25 26 |
# File 'lib/rfc/web/link/parsers/list.rb', line 19 def initialize relation_pattern: RELATION_PATTERN, line: Line.new, list: Models::List.new @scanner = StringScanner.new "" @relation_pattern = relation_pattern @line = line @list = list @comma = "," @quote = %(") end |
Instance Method Details
#call(text, root_uri:) ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/rfc/web/link/parsers/list.rb', line 28 def call text, root_uri: text = String text list.clear return list unless text.start_with? "<" scanner.string = text build_list root_uri end |