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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 88daefd24fb535d60be1252cb33ca632d6466c0f
4
- data.tar.gz: abe5bde9ae30c13d6a424268e85606b383179d42
3
+ metadata.gz: 94c141298bd94fe5be1c1facece4c4c3b3833601
4
+ data.tar.gz: e747e9e4e8eb54e8703fb2763ae718ccc9cdddf2
5
5
  SHA512:
6
- metadata.gz: 2726362f0e0d4dd95bf87c50f795f557ef670007b80990c22f1425a955d23d93796623433b50e0344075fd96260ddfbfbe88988edea541c19caf863894744985
7
- data.tar.gz: 7d66fd52f27ceb87085d643cb8f0df8aeda19747e23cf69b9bb2811b610c5283aa87d9bfa6cd9f45017303ef6e9b477c56da57a6aeb7e10e4fec5098822605d9
6
+ metadata.gz: 01cc35baece47af8cbdfbbc0a1633287d1205c9bd81a1f6b69b07854c21662ead2b72acbedf477ae3e8ddb4779bf05b9dadd4c4898720d073531913a1245cfb4
7
+ data.tar.gz: b216663dab188b2ea1f37b6e635c7fe290a63900cf8282f402e2a53a9eabb19bcbcdb4a570dcde348de7c57f909dd51b7dc9fa1acad1a4ccae52be7131227e47
@@ -1,3 +1,4 @@
1
+ require 'nokogiri'
1
2
  require 'pincers/backend/base'
2
3
 
3
4
  module Pincers::Backend
@@ -1,3 +1,4 @@
1
+ require 'selenium-webdriver'
1
2
  require 'pincers/backend/base'
2
3
 
3
4
  module Pincers::Backend
@@ -16,6 +16,10 @@ module Pincers::Core
16
16
  self
17
17
  end
18
18
 
19
+ def root?
20
+ true
21
+ end
22
+
19
23
  def backend
20
24
  @backend
21
25
  end
@@ -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
- wrap_errors do
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
@@ -1,3 +1,3 @@
1
1
  module Pincers
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
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.3.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-24 00:00:00.000000000 Z
11
+ date: 2015-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: selenium-webdriver
14
+ name: nokogiri
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: '2.45'
20
- type: :development
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: '2.45'
26
+ version: 1.6.6
27
27
  - !ruby/object:Gem::Dependency
28
- name: nokogiri
28
+ name: selenium-webdriver
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: 1.6.6
34
- type: :development
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: 1.6.6
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