class UrlFinder::BaseReader
Base class for reader implementations
Attributes
content[R]
Public Class Methods
new(content)
click to toggle source
Initialize reader @param [String] string to find URLs in
# File lib/url_finder/readers/base_reader.rb, line 18 def initialize(content) @content = content @urls = nil end
urls(*args)
click to toggle source
Alias for new @return [BaseReader] instance of BaseReader
# File lib/url_finder/readers/base_reader.rb, line 8 def self.urls(*args) new(*args) end
Public Instance Methods
each(&block)
click to toggle source
Yield each url @see Enumerable#each
# File lib/url_finder/readers/base_reader.rb, line 25 def each(&block) urls.each(&block) end
empty?()
click to toggle source
Returns true if no URLs were found @return [true, false] true if no URLs were found
# File lib/url_finder/readers/base_reader.rb, line 36 def empty? urls.empty? end
to_a()
click to toggle source
Returns the URLs as an array @return [Array<String>] the found URLs
# File lib/url_finder/readers/base_reader.rb, line 42 def to_a urls end
urls()
click to toggle source
@raise [NotImplementedError] raises since this should be implemented in subclass
# File lib/url_finder/readers/base_reader.rb, line 30 def urls raise(NotImplementedError, 'subclass must implement!') end