Class: Nokorexi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(x, noscript: true, debug: false) ⇒ Nokorexi

Returns a new instance of Nokorexi.



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/nokorexi.rb', line 14

def initialize(x, noscript: true, debug: false)
  
  s = RXFHelper.read(x).first[/.*<\/html>$/m]
  
  raw_doc = Nokogiri::HTML(s.gsub("&nbsp;",' '))
  raw_doc.xpath('//script').each(&:remove) if noscript
  
  @to_s = xml = raw_doc.xpath('html').to_xml
  @to_doc = Rexle.new(xml, debug: debug)
  
end

Instance Attribute Details

#to_docObject (readonly)

Returns the value of attribute to_doc.



12
13
14
# File 'lib/nokorexi.rb', line 12

def to_doc
  @to_doc
end

#to_sObject (readonly)

Returns the value of attribute to_s.



12
13
14
# File 'lib/nokorexi.rb', line 12

def to_s
  @to_s
end