pincers 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pincers/backend/nokogiri.rb +1 -0
- data/lib/pincers/backend/webdriver.rb +1 -0
- data/lib/pincers/core/root_context.rb +4 -0
- data/lib/pincers/core/search_context.rb +13 -3
- data/lib/pincers/extension/labs.rb +19 -0
- data/lib/pincers/version.rb +1 -1
- metadata +11 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94c141298bd94fe5be1c1facece4c4c3b3833601
|
4
|
+
data.tar.gz: e747e9e4e8eb54e8703fb2763ae718ccc9cdddf2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 01cc35baece47af8cbdfbbc0a1633287d1205c9bd81a1f6b69b07854c21662ead2b72acbedf477ae3e8ddb4779bf05b9dadd4c4898720d073531913a1245cfb4
|
7
|
+
data.tar.gz: b216663dab188b2ea1f37b6e635c7fe290a63900cf8282f402e2a53a9eabb19bcbcdb4a570dcde348de7c57f909dd51b7dc9fa1acad1a4ccae52be7131227e47
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'pincers/extension/queries'
|
2
2
|
require 'pincers/extension/actions'
|
3
|
+
require 'pincers/extension/labs'
|
3
4
|
require 'pincers/support/query'
|
4
5
|
|
5
6
|
module Pincers::Core
|
@@ -8,6 +9,7 @@ module Pincers::Core
|
|
8
9
|
extend Forwardable
|
9
10
|
include Pincers::Extension::Queries
|
10
11
|
include Pincers::Extension::Actions
|
12
|
+
include Pincers::Extension::Labs
|
11
13
|
|
12
14
|
attr_reader :parent, :query
|
13
15
|
|
@@ -28,6 +30,10 @@ module Pincers::Core
|
|
28
30
|
parent.root
|
29
31
|
end
|
30
32
|
|
33
|
+
def root?
|
34
|
+
false
|
35
|
+
end
|
36
|
+
|
31
37
|
def backend
|
32
38
|
root.backend
|
33
39
|
end
|
@@ -65,9 +71,7 @@ module Pincers::Core
|
|
65
71
|
|
66
72
|
def [](*args)
|
67
73
|
if args[0].is_a? String or args[0].is_a? Symbol
|
68
|
-
|
69
|
-
backend.extract_element_attribute element!, args[0]
|
70
|
-
end
|
74
|
+
attribute args[0]
|
71
75
|
else
|
72
76
|
wrap_siblings Array(elements.send(:[],*args))
|
73
77
|
end
|
@@ -99,6 +103,12 @@ module Pincers::Core
|
|
99
103
|
end
|
100
104
|
end
|
101
105
|
|
106
|
+
def attribute(_name)
|
107
|
+
wrap_errors do
|
108
|
+
backend.extract_element_attribute element!, _name
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
102
112
|
def tag
|
103
113
|
wrap_errors do
|
104
114
|
backend.extract_element_tag(element!).downcase
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Pincers::Extension
|
2
|
+
module Labs
|
3
|
+
|
4
|
+
def readonly(&_block)
|
5
|
+
nk_root = Pincers.for_nokogiri to_html
|
6
|
+
|
7
|
+
unless root?
|
8
|
+
nk_root = nk_root.css('body > *') # nokogiri will inject valid html structure around contents
|
9
|
+
end
|
10
|
+
|
11
|
+
if _block.nil?
|
12
|
+
nk_root
|
13
|
+
else
|
14
|
+
_block.call(nk_root)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
data/lib/pincers/version.rb
CHANGED
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pincers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ignacio Baixas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: nokogiri
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
20
|
-
type: :
|
19
|
+
version: 1.6.6
|
20
|
+
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 1.6.6
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: selenium-webdriver
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
34
|
-
type: :
|
33
|
+
version: '2.45'
|
34
|
+
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: '2.45'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -220,6 +220,7 @@ files:
|
|
220
220
|
- lib/pincers/core/search_context.rb
|
221
221
|
- lib/pincers/errors.rb
|
222
222
|
- lib/pincers/extension/actions.rb
|
223
|
+
- lib/pincers/extension/labs.rb
|
223
224
|
- lib/pincers/extension/queries.rb
|
224
225
|
- lib/pincers/factory.rb
|
225
226
|
- lib/pincers/support/configuration.rb
|