lib/docparser/document.rb in docparser-0.1.2 vs lib/docparser/document.rb in docparser-0.1.3
- old
+ new
@@ -3,10 +3,14 @@
# The Document class loads and parses the files.
# @see Parser
# @see Output
class Document
attr_reader :filename, :doc, :encoding, :results
+
+ # @return [String] the source of the document
+ attr_reader :html
+
def initialize(filename: nil, encoding: 'utf-8', parser: nil)
if encoding == 'utf-8'
encodingstring = 'r:utf-8'
else
encodingstring = "r:#{encoding}:utf-8"
@@ -33,14 +37,9 @@
# Extracts the document title
# @return [String] the title of the document
def title
@title ||= xpath_content('//head/title')
- end
-
- # @return [String] the source of the document
- def html
- @html
end
# Executes a xpath query
def xpath(query)
res = @doc.search(query)
\ No newline at end of file