rconditions 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README +10 -1
- data/lib/rconditions.rb +2 -2
- metadata +38 -38
data/README
CHANGED
@@ -7,6 +7,15 @@ will throw an exception. The exception will include auto-generated modules
|
|
7
7
|
that give information which predicate methods passed or failed in the bang
|
8
8
|
method's execution.
|
9
9
|
|
10
|
+
== Download
|
11
|
+
|
12
|
+
RConditions is hosted on RubyForge[http://www.rubyforge.org/], and published as a gem. Installation is straightforward:
|
13
|
+
|
14
|
+
1. Install RubyGems[http://rubyforge.org/projects/rubygems]
|
15
|
+
2. <tt>gem install rconditions</tt>
|
16
|
+
|
17
|
+
You may also download the gem on {RConditions's RubyForge project page}[http://www.rubyforge.org/projects/rconditions/].
|
18
|
+
|
10
19
|
== Example
|
11
20
|
|
12
21
|
require "rconditions"
|
@@ -88,7 +97,7 @@ methods. A simple test setup using mongrel/rails was slowed down by more than
|
|
88
97
|
|
89
98
|
The performance penalty can be avoided by applying RConditions only to new
|
90
99
|
methods, that is, methods defined after <tt>require "rconditions"</tt>. To
|
91
|
-
achieve this, set <tt
|
100
|
+
achieve this, set <tt>::RCONDITIONS_ONLY_FOR_NEW_METHODS = true</tt> before
|
92
101
|
the require call. Our test setup had no measurable slowdown afterwards.
|
93
102
|
|
94
103
|
== Supported Ruby Versions
|
data/lib/rconditions.rb
CHANGED
@@ -26,7 +26,7 @@ module RConditions
|
|
26
26
|
# Extends almost all predicate methods and defines bang methods for them.
|
27
27
|
# You should never call this method yourself, it is called automatically
|
28
28
|
# when RConditions is required. To prevent it from being called, set
|
29
|
-
# <tt
|
29
|
+
# <tt>::RCONDITIONS_ONLY_FOR_NEW_METHODS</tt> to <tt>true</tt> before
|
30
30
|
# requiring RConditions.
|
31
31
|
def extend_predicate_methods_and_define_bang_methods
|
32
32
|
ObjectSpace.each_object(Module) do |mod|
|
@@ -63,7 +63,7 @@ module RConditions
|
|
63
63
|
mod.const_set(negative_module, Module.new) unless mod.const_defined?(negative_module)
|
64
64
|
|
65
65
|
time = Time.now
|
66
|
-
predicate_method_without_rconditions = "#{predicate_method_without_questionmark}_rconditions_#{mod.object_id}_#{time.to_i}_#{time.usec}"
|
66
|
+
predicate_method_without_rconditions = "#{predicate_method_without_questionmark}_rconditions_#{mod.object_id.abs}_#{time.to_i}_#{time.usec}"
|
67
67
|
|
68
68
|
mod.class_eval <<-EOS, __FILE__, __LINE__ + 1
|
69
69
|
alias_method :#{predicate_method_without_rconditions}, :#{predicate_method}
|
metadata
CHANGED
@@ -1,17 +1,41 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
rubygems_version: 0.9.2
|
3
|
+
specification_version: 1
|
4
|
+
name: rconditions
|
5
|
+
version: !ruby/object:Gem::Version
|
6
|
+
version: 0.3.1
|
7
|
+
date: 2007-11-12 00:00:00 +01:00
|
8
|
+
summary: Generates a bang method for each predicate method.
|
9
|
+
require_paths:
|
10
|
+
- lib
|
11
|
+
email: tammo@tammofreese.de
|
2
12
|
homepage: http://rconditions.rubyforge.org
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
13
|
+
rubyforge_project:
|
14
|
+
description: RConditions generates a bang method (for example, Array#empty!) for each predicate method (for example, Array#empty?). The bang method will return true if the predicate method returns true, otherwise it will throw an exception. The exception will include auto-generated modules that give information on predicate methods passed or failed in the bang method's execution.
|
15
|
+
autorequire: rconditions
|
16
|
+
default_executable:
|
17
|
+
bindir: bin
|
18
|
+
has_rdoc: true
|
19
|
+
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.0.0
|
24
|
+
version:
|
25
|
+
platform: ruby
|
26
|
+
signing_key:
|
27
|
+
cert_chain:
|
7
28
|
post_install_message:
|
8
|
-
|
29
|
+
authors:
|
30
|
+
- Norman Timmler
|
31
|
+
- Tammo Freese
|
9
32
|
files:
|
10
33
|
- test/rconditions_test.rb
|
11
34
|
- lib/rconditions.rb
|
12
35
|
- README
|
13
36
|
- MIT-LICENSE
|
14
|
-
|
37
|
+
test_files:
|
38
|
+
- test/rconditions_test.rb
|
15
39
|
rdoc_options:
|
16
40
|
- --title
|
17
41
|
- RConditions RDoc Documentation
|
@@ -19,38 +43,14 @@ rdoc_options:
|
|
19
43
|
- README
|
20
44
|
- --charset
|
21
45
|
- utf-8
|
22
|
-
signing_key:
|
23
|
-
cert_chain:
|
24
|
-
name: rconditions
|
25
|
-
has_rdoc: true
|
26
|
-
platform: ruby
|
27
|
-
summary: RConditions generates a bang method (for example, Array#empty!) for each
|
28
|
-
predicate method (for example, Array#empty?). The bang method will return true if
|
29
|
-
the predicate method returns true, otherwise it will throw an exception. The exception
|
30
|
-
will include auto-generated modules that give information on predicate methods passed
|
31
|
-
or failed in the bang method's execution.
|
32
|
-
default_executable:
|
33
|
-
bindir: bin
|
34
|
-
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
35
|
-
version:
|
36
|
-
requirements:
|
37
|
-
- - '>'
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
version: 0.0.0
|
40
|
-
require_paths:
|
41
|
-
- lib
|
42
|
-
specification_version: 1
|
43
|
-
test_files:
|
44
|
-
- test/rconditions_test.rb
|
45
|
-
dependencies: []
|
46
|
-
description:
|
47
|
-
authors:
|
48
|
-
- Norman Timmler
|
49
|
-
- Tammo Freese
|
50
|
-
email: tammo@tammofreese.de
|
51
46
|
extra_rdoc_files:
|
52
47
|
- README
|
53
48
|
- MIT-LICENSE
|
49
|
+
executables: []
|
50
|
+
|
51
|
+
extensions: []
|
52
|
+
|
54
53
|
requirements: []
|
55
|
-
|
56
|
-
|
54
|
+
|
55
|
+
dependencies: []
|
56
|
+
|