Class: Annal::Document
- Inherits:
-
Object
- Object
- Annal::Document
- Defined in:
- lib/annal/document.rb
Instance Attribute Summary collapse
-
#fetch ⇒ Object
Returns the value of attribute fetch.
-
#raw_string ⇒ Object
Returns the value of attribute raw_string.
Class Method Summary collapse
Instance Method Summary collapse
- #data ⇒ Object
-
#initialize(file_or_str) ⇒ Document
constructor
A new instance of Document.
- #parse ⇒ Object
- #text ⇒ Object
Constructor Details
#initialize(file_or_str) ⇒ Document
Returns a new instance of Document.
12 13 14 15 16 17 18 |
# File 'lib/annal/document.rb', line 12 def initialize(file_or_str) if file_or_str.respond_to?(:read) self.fetch = file_or_str else self.raw_string = file_or_str end end |
Instance Attribute Details
#fetch ⇒ Object
Returns the value of attribute fetch.
10 11 12 |
# File 'lib/annal/document.rb', line 10 def fetch @fetch end |
#raw_string ⇒ Object
Returns the value of attribute raw_string.
10 11 12 |
# File 'lib/annal/document.rb', line 10 def raw_string @raw_string end |
Class Method Details
Instance Method Details
#data ⇒ Object
29 30 31 |
# File 'lib/annal/document.rb', line 29 def data parse.data end |
#text ⇒ Object
20 21 22 23 |
# File 'lib/annal/document.rb', line 20 def text fetch && fetch.read or raw_string end |