why_not 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -1
- data/Rakefile +1 -1
- data/lib/why_not.rb +4 -4
- metadata +12 -5
data/README.rdoc
CHANGED
data/Rakefile
CHANGED
@@ -13,7 +13,7 @@ spec = Gem::Specification.new do |s|
|
|
13
13
|
s.description = 'not_empty?, not_blank?, not_defined? ... why not? This is Ruby, come on.'
|
14
14
|
s.summary = 'Comprehensive negation for all Ruby predicate methods.'
|
15
15
|
|
16
|
-
s.add_dependency('meta_programming', '>= 0.0
|
16
|
+
s.add_dependency('meta_programming', '>=0.2.0', '< 0.3.0')
|
17
17
|
|
18
18
|
exclude_folders = '' # 'spec/rails/{doc,lib,log,nbproject,tmp,vendor,test}'
|
19
19
|
exclude_files = [] # FileList['**/*.log'] + FileList[exclude_folders+'/**/*'] + FileList[exclude_folders]
|
data/lib/why_not.rb
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
require 'meta_programming'
|
2
2
|
|
3
3
|
class Object
|
4
|
-
define_ghost_method(/^not_.+\?$/) do |
|
4
|
+
define_ghost_method(/^not_.+\?$/) do |symbol, *args|
|
5
5
|
symbol.to_s =~ /^not_(.+\?)$/
|
6
6
|
regular_method = $1.to_sym
|
7
|
-
!
|
7
|
+
!__send__(regular_method, *args)
|
8
8
|
end
|
9
|
-
define_ghost_method(/^is(nt|_not)_.+\?$/) do |
|
9
|
+
define_ghost_method(/^is(nt|_not)_.+\?$/) do |symbol, *args|
|
10
10
|
(method = symbol.to_s) =~ /^is(nt|_not)_/
|
11
11
|
regular_method = case $1
|
12
12
|
when 'nt' then method.gsub(/^isnt_/, 'is_').to_sym
|
13
13
|
when '_not' then method.gsub(/^is_not_/, 'is_').to_sym
|
14
14
|
end
|
15
|
-
!
|
15
|
+
!__send__(regular_method, *args)
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 4
|
9
|
+
version: 0.0.4
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Jeff Patmon
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-05-
|
17
|
+
date: 2010-05-02 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -26,9 +26,16 @@ dependencies:
|
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
segments:
|
28
28
|
- 0
|
29
|
+
- 2
|
29
30
|
- 0
|
30
|
-
|
31
|
-
|
31
|
+
version: 0.2.0
|
32
|
+
- - <
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
segments:
|
35
|
+
- 0
|
36
|
+
- 3
|
37
|
+
- 0
|
38
|
+
version: 0.3.0
|
32
39
|
type: :runtime
|
33
40
|
version_requirements: *id001
|
34
41
|
description: not_empty?, not_blank?, not_defined? ... why not? This is Ruby, come on.
|