azebiki 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -70,6 +70,7 @@ module Azebiki
70
70
 
71
71
  @options.each do |key, value|
72
72
  next if key == :failure_message
73
+ next if key == :not
73
74
  next if key == :content unless @expected == "meta"
74
75
  next if key == :count
75
76
  if value.is_a?(Hash)
@@ -95,11 +96,17 @@ module Azebiki
95
96
  @block ||= block
96
97
  matched = matches(stringlike)
97
98
 
98
- if @options[:count]
99
+ result = if @options[:count]
99
100
  matched.size == @options[:count] && (!@block || @block.call(matched))
100
101
  else
101
102
  matched.any? && (!@block || @block.call(matched))
102
103
  end
104
+
105
+ if @options[:not]
106
+ !result
107
+ else
108
+ result
109
+ end
103
110
  end
104
111
 
105
112
 
@@ -202,6 +209,12 @@ module Azebiki
202
209
 
203
210
  def tag.failure_message(text)
204
211
  self[:failure_message] = text
212
+ self
213
+ end
214
+
215
+ def tag.!
216
+ self[:not] = true
217
+ self
205
218
  end
206
219
 
207
220
  return tag
@@ -1,3 +1,3 @@
1
1
  module Azebiki
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: azebiki
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.6
5
+ version: 0.0.7
6
6
  platform: ruby
7
7
  authors:
8
8
  - Eric Allam