owrb 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/owrb.rb +19 -1
- data/lib/owrb/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87ef90e379f05340df4f5e0bb581496cb040e377
|
4
|
+
data.tar.gz: 5b2c2318d241c9517a7b6dafe96f774d2aad7903
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cbf2c75fa072c9a65f053973942b14b1ff4052532b384140cba382a802ee7f4f1a0ffc2436e58be13a29c5892fe7edb7c4b69f25bbc5d4e49e297bf5c7c5b9db
|
7
|
+
data.tar.gz: 47f3ccf1a0081e2182b5f0ac30b48ba38704482dfee5e88119787503b7a101e400e7bd1da520eced4c3c7ceb6838be6846e9c8da3863e1d73d2d972796d1da4f
|
data/lib/owrb.rb
CHANGED
@@ -24,18 +24,30 @@ module Owrb
|
|
24
24
|
|
25
25
|
module HTML
|
26
26
|
class Element
|
27
|
-
attr_reader :name, :attributes
|
27
|
+
attr_reader :element, :name, :attributes, :inner_html
|
28
28
|
|
29
29
|
def initialize( element )
|
30
|
+
@element = element
|
30
31
|
@name = element.name
|
31
32
|
@attributes = {}
|
32
33
|
element.attributes.each{|name, attribute|
|
33
34
|
@attributes[ attribute.name ] = attribute.value
|
34
35
|
}
|
36
|
+
@inner_html = element.inner_html
|
37
|
+
end
|
38
|
+
|
39
|
+
def to_h
|
40
|
+
{
|
41
|
+
:name => @name,
|
42
|
+
:attributes => @attributes,
|
43
|
+
:inner_html => @inner_html,
|
44
|
+
}
|
35
45
|
end
|
36
46
|
end
|
37
47
|
|
38
48
|
class Document
|
49
|
+
attr_reader :document
|
50
|
+
|
39
51
|
def initialize( document )
|
40
52
|
@document = document
|
41
53
|
end
|
@@ -55,6 +67,8 @@ module Owrb
|
|
55
67
|
end
|
56
68
|
|
57
69
|
class Browser
|
70
|
+
attr_reader :browser
|
71
|
+
|
58
72
|
def initialize( type = :phantomjs )
|
59
73
|
@browser = Watir::Browser.new( type )
|
60
74
|
end
|
@@ -74,6 +88,10 @@ module Owrb
|
|
74
88
|
def quit
|
75
89
|
@browser.quit
|
76
90
|
end
|
91
|
+
|
92
|
+
def document
|
93
|
+
HTML.parse( @browser.html )
|
94
|
+
end
|
77
95
|
end
|
78
96
|
|
79
97
|
=begin
|
data/lib/owrb/version.rb
CHANGED