Module: Readability::Readable
Instance Attribute Summary collapse
Instance Method Summary
collapse
#execute_js, #harmony_page, #load_js, #parse, #window
Instance Attribute Details
#read_margin ⇒ Object
13
14
15
|
# File 'lib/readability/readable.rb', line 13
def read_margin
@read_margin ||= Readability::Margin::MEDIUM
end
|
#read_size ⇒ Object
9
10
11
|
# File 'lib/readability/readable.rb', line 9
def read_size
@read_size ||= Readability::Size::MEDIUM
end
|
Instance Method Details
#to_readable(args = {}) ⇒ Object
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/readability/readable.rb', line 25
def to_readable(args = {})
readable_doc = self.dup
readable_doc.remove('script')
readable_doc.remove('iframe')
readable_doc.harmony_page do |page|
page.window.readStyle = @read_style
page.window.readSize = @read_size
page.window.readMargin = @read_margin
page.load(File.join(File.dirname(__FILE__), 'js', 'readability.js'))
end
readable_doc.remove('br') if args[:remove_br]
readable_doc.remove('#readFooter') if args[:remove_footer]
if args[:content_only]
return readable_doc.at_css("#readInner")
end
readable_doc.root
end
|
#to_readable!(args = {}) ⇒ Object
58
59
60
|
# File 'lib/readability/readable.rb', line 58
def to_readable!(args = {})
self.root = to_readable(args)
end
|
#unlink(*paths) ⇒ Object
Also known as:
remove
19
20
21
|
# File 'lib/readability/readable.rb', line 19
def unlink(*paths)
self.search(*paths).unlink
end
|