module Reader

Public Class Methods

html_document(source) click to toggle source
# File lib/find_identical/reader.rb, line 5
def html_document(source)
    remote_file?(source) ? remote_html(source) : local_html(source)
end

Private Class Methods

local_html(path) click to toggle source
# File lib/find_identical/reader.rb, line 11
def local_html(path)
    File.read(path)
end
remote_file?(source) click to toggle source
# File lib/find_identical/reader.rb, line 21
def remote_file?(source)
    source.match(/^https?:\/\/.+$/)
end
remote_html(address) click to toggle source
# File lib/find_identical/reader.rb, line 16
def remote_html(address)
    Typhoeus.get(address).body
end