Module: Burly
- Defined in:
- lib/burly.rb,
lib/burly/parser.rb,
lib/burly/exceptions.rb,
lib/burly/parsers/html_parser.rb,
lib/burly/parsers/json_parser.rb,
lib/burly/parsers/plaintext_parser.rb
Defined Under Namespace
Modules: Parsers Classes: Parser, UnsupportedMimeType
Class Attribute Summary collapse
- .registered_parsers ⇒ Object readonly private
Class Method Summary collapse
-
.parse(document, mime_type: "text/plain", **options) ⇒ Array<String>
Parse a document for URLs.
- .register_parser(klass) ⇒ Object private
Class Attribute Details
.registered_parsers ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
16 17 18 |
# File 'lib/burly.rb', line 16 def registered_parsers @registered_parsers end |
Class Method Details
.parse(document, mime_type: "text/plain", **options) ⇒ Array<String>
Parse a document for URLs.
36 37 38 39 40 41 42 |
# File 'lib/burly.rb', line 36 def self.parse(document, mime_type: "text/plain", **) parser = registered_parsers[mime_type] raise UnsupportedMimeType unless parser parser.new(document, **).parse end |
.register_parser(klass) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
45 46 47 |
# File 'lib/burly.rb', line 45 def self.register_parser(klass) klass.mime_types.each { |mime_type| @registered_parsers[mime_type] = klass } end |