Class: Scrapetor::Dom::Text
- Inherits:
-
Object
- Object
- Scrapetor::Dom::Text
show all
- Includes:
- NodeMethods
- Defined in:
- lib/scrapetor/dom.rb
Instance Attribute Summary collapse
Attributes included from NodeMethods
#parent
Instance Method Summary
collapse
#add_next_sibling, #add_previous_sibling, #comment?, #doctype?, #document, #element?, #next_element_sibling, #next_sibling, #previous_element_sibling, #previous_sibling, #remove, #replace
Constructor Details
#initialize(data, parent: nil) ⇒ Text
Returns a new instance of Text.
360
361
362
363
|
# File 'lib/scrapetor/dom.rb', line 360
def initialize(data, parent: nil)
@data = data.to_s
@parent = parent
end
|
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
359
360
361
|
# File 'lib/scrapetor/dom.rb', line 359
def data
@data
end
|
Instance Method Details
#content ⇒ Object
365
|
# File 'lib/scrapetor/dom.rb', line 365
def content; @data; end
|
#name ⇒ Object
367
|
# File 'lib/scrapetor/dom.rb', line 367
def name; "#text"; end
|
#node_type ⇒ Object
370
|
# File 'lib/scrapetor/dom.rb', line 370
def node_type; 3; end
|
#text ⇒ Object
364
|
# File 'lib/scrapetor/dom.rb', line 364
def text; @data; end
|
#text? ⇒ Boolean
366
|
# File 'lib/scrapetor/dom.rb', line 366
def text?; true; end
|
#to_html ⇒ Object
368
|
# File 'lib/scrapetor/dom.rb', line 368
def to_html; Dom.escape_text(@data); end
|
#to_s ⇒ Object
369
|
# File 'lib/scrapetor/dom.rb', line 369
def to_s; @data; end
|