Class: Tumblargh::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/tumblargh/parser.rb

Constant Summary collapse

@@parser =
TumblrParser.new

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#fileObject

Returns the value of attribute file.



24
25
26
# File 'lib/tumblargh/parser.rb', line 24

def file
  @file
end

Instance Method Details

#htmlObject



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

#optionsObject



47
48
49
# File 'lib/tumblargh/parser.rb', line 47

def options
  @options ||= extract_options
end

#to_sObject



51
52
53
54
# File 'lib/tumblargh/parser.rb', line 51

def to_s
  parse unless @structure
  @structure.to_s
end

#treeObject



43
44
45
# File 'lib/tumblargh/parser.rb', line 43

def tree
  @tree ||= parse
end