class UrlFinder::Reader
Handles reader delegatation
Constants
- FORMAT_READERS
Attributes
content[R]
The raw content
Public Class Methods
new(content, file_format)
click to toggle source
Instansiates reader
# File lib/url_finder/reader.rb, line 25 def initialize(content, file_format) @content = content @file_format = file_format end
Public Instance Methods
file_format()
click to toggle source
Returns the file format @return [String] the file format
# File lib/url_finder/reader.rb, line 32 def file_format @file_format.to_s.downcase end
urls()
click to toggle source
Returns the appropriate reader for the given file format or raises error @return [BaseReader] subclass of base reader
# File lib/url_finder/reader.rb, line 38 def urls reader_klass = FORMAT_READERS.fetch(file_format) do raise(ArgumentError, "unknown format #{file_format}") end reader_klass.new(content) end