Class: Tumblargh::Parser
- Inherits:
-
Object
- Object
- Tumblargh::Parser
- Defined in:
- lib/tumblargh/parser.rb
Constant Summary collapse
- @@parser =
TumblrParser.new
Instance Attribute Summary collapse
-
#file ⇒ Object
Returns the value of attribute file.
Instance Method Summary collapse
- #html ⇒ Object
- #html=(html) ⇒ Object
-
#initialize(template = nil) ⇒ Parser
constructor
A new instance of Parser.
- #options ⇒ Object
- #to_s ⇒ Object
- #tree ⇒ Object
Constructor Details
#initialize(template = nil) ⇒ Parser
Returns a new instance of Parser.
20 21 22 |
# File 'lib/tumblargh/parser.rb', line 20 def initialize(template=nil) self.file = template end |
Instance Attribute Details
#file ⇒ Object
Returns the value of attribute file.
24 25 26 |
# File 'lib/tumblargh/parser.rb', line 24 def file @file end |
Instance Method Details
#html ⇒ Object
39 40 41 |
# File 'lib/tumblargh/parser.rb', line 39 def html @html ||= open(@file).read end |
#html=(html) ⇒ Object
34 35 36 37 |
# File 'lib/tumblargh/parser.rb', line 34 def html=(html) self.file = nil @html = html end |
#options ⇒ Object
47 48 49 |
# File 'lib/tumblargh/parser.rb', line 47 def @options ||= end |
#to_s ⇒ Object
51 52 53 54 |
# File 'lib/tumblargh/parser.rb', line 51 def to_s parse unless @structure @structure.to_s end |
#tree ⇒ Object
43 44 45 |
# File 'lib/tumblargh/parser.rb', line 43 def tree @tree ||= parse end |