azebiki 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -88,8 +88,32 @@ module Azebiki
88
88
 
89
89
  def add_content_condition_to(query)
90
90
  if @options[:content] and @expected != "meta"
91
- query << "[contains(., #{xpath_escape(@options[:content])})]"
91
+ if @options[:content].is_a?(Hash) and @options[:content][:regex]
92
+ query << "[regex(., #{xpath_escape(@options[:content][:to_s])})]"
93
+ else
94
+ query << "[contains(., #{xpath_escape(@options[:content])})]"
95
+ end
96
+ end
97
+ end
98
+
99
+ def nokogiri_matches(stringlike)
100
+ if Nokogiri::XML::NodeSet === stringlike
101
+ @query = query.gsub(%r'^//', './/')
102
+ else
103
+ @query = query
92
104
  end
105
+
106
+ add_options_conditions_to(@query)
107
+
108
+ args = [@query]
109
+ args << Class.new {
110
+ def self.regex(node_set, regex)
111
+ node_set.find_all { |node| node.content =~ /#{regex}/i }
112
+ end
113
+ }
114
+
115
+ @document = Webrat::XML.document(stringlike)
116
+ @document.xpath(*args)
93
117
  end
94
118
 
95
119
  def matches?(stringlike, &block)
@@ -1,3 +1,3 @@
1
1
  module Azebiki
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
metadata CHANGED
@@ -1,39 +1,34 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: azebiki
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.8
4
5
  prerelease:
5
- version: 0.0.7
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Eric Allam
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-08-16 00:00:00 -04:00
14
- default_executable:
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
12
+ date: 2011-09-01 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
17
15
  name: webrat
18
- prerelease: false
19
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &70128470878020 !ruby/object:Gem::Requirement
20
17
  none: false
21
- requirements:
22
- - - ">="
23
- - !ruby/object:Gem::Version
24
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
25
22
  type: :runtime
26
- version_requirements: *id001
27
- description: ""
28
- email:
23
+ prerelease: false
24
+ version_requirements: *70128470878020
25
+ description: ''
26
+ email:
29
27
  - eric@envylabs.com
30
28
  executables: []
31
-
32
29
  extensions: []
33
-
34
30
  extra_rdoc_files: []
35
-
36
- files:
31
+ files:
37
32
  - lib/azebiki/azebiki.rb
38
33
  - lib/azebiki/version.rb
39
34
  - lib/azebiki.rb
@@ -41,33 +36,28 @@ files:
41
36
  - CHANGELOG.md
42
37
  - README.md
43
38
  - ROADMAP.md
44
- has_rdoc: true
45
39
  homepage: http://github.com/rubymaverick/azebiki
46
40
  licenses: []
47
-
48
41
  post_install_message:
49
42
  rdoc_options: []
50
-
51
- require_paths:
43
+ require_paths:
52
44
  - lib
53
- required_ruby_version: !ruby/object:Gem::Requirement
45
+ required_ruby_version: !ruby/object:Gem::Requirement
54
46
  none: false
55
- requirements:
56
- - - ">="
57
- - !ruby/object:Gem::Version
58
- version: "0"
59
- required_rubygems_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ! '>='
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
51
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
52
  none: false
61
- requirements:
62
- - - ">="
63
- - !ruby/object:Gem::Version
53
+ requirements:
54
+ - - ! '>='
55
+ - !ruby/object:Gem::Version
64
56
  version: 1.3.6
65
57
  requirements: []
66
-
67
58
  rubyforge_project: azebiki
68
- rubygems_version: 1.3.9.1
59
+ rubygems_version: 1.8.10
69
60
  signing_key:
70
61
  specification_version: 3
71
62
  summary: A DSL for validating HTML
72
63
  test_files: []
73
-