Class: Spider::Tag

Inherits:
Object show all
Defined in:
lib/spiderfw/tag/tag.rb

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(el) ⇒ Tag

Returns a new instance of Tag.



17
18
19
20
# File 'lib/spiderfw/tag/tag.rb', line 17

def initialize(el)
    @attributes = el.attributes.to_hash
    @content = el.innerHTML
end

Class Attribute Details

.pathObject

Returns the value of attribute path.



8
9
10
# File 'lib/spiderfw/tag/tag.rb', line 8

def path
  @path
end

Class Method Details

.new_class(path) ⇒ Object



10
11
12
13
14
# File 'lib/spiderfw/tag/tag.rb', line 10

def new_class(path)
    k = Class.new(self)
    k.path = path
    return k
end

Instance Method Details

#renderObject



22
23
24
# File 'lib/spiderfw/tag/tag.rb', line 22

def render
    return ERB.new(IO.read(self.class.path)).result(binding)
end