not_naughty 0.4 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/not_naughty/validations/acceptance_validation.rb +1 -1
- data/lib/not_naughty.rb +8 -5
- metadata +2 -3
data/Rakefile
CHANGED
@@ -9,7 +9,7 @@ include FileUtils
|
|
9
9
|
# Configuration
|
10
10
|
##############################################################################
|
11
11
|
NAME = "not_naughty"
|
12
|
-
VERS = "0.4"
|
12
|
+
VERS = "0.4.1"
|
13
13
|
CLEAN.include ["**/.*.sw?", "pkg/*", ".config", "doc/*", "coverage/*"]
|
14
14
|
RDOC_OPTS = [
|
15
15
|
"--quiet",
|
@@ -25,7 +25,7 @@ module NotNaughty
|
|
25
25
|
# valid.errors.on(:to_s).any? # => false
|
26
26
|
class AcceptanceValidation < Validation
|
27
27
|
|
28
|
-
def initialize(opts, attributes)
|
28
|
+
def initialize(opts, attributes) #:nodoc:
|
29
29
|
__message, __accept =
|
30
30
|
opts[:message] || '#{"%s".humanize} not accepted.',
|
31
31
|
opts[:accept] || '1'
|
data/lib/not_naughty.rb
CHANGED
@@ -45,18 +45,21 @@ module NotNaughty
|
|
45
45
|
# The above examples work as long validator is not already called. To reset
|
46
46
|
# an already assigned validator set <tt>@validator</tt> to nil.
|
47
47
|
def validator(*states)
|
48
|
-
@validator ||= if
|
49
|
-
superclass.validator.clone
|
50
|
-
|
51
|
-
else
|
48
|
+
@validator ||= if !states.empty?
|
52
49
|
validator_klass =
|
53
|
-
if states
|
50
|
+
if states.first.is_a? Class and states.first <= NotNaughty::Validator
|
54
51
|
states.shift
|
55
52
|
else
|
56
53
|
NotNaughty::Validator
|
57
54
|
end
|
58
55
|
|
59
56
|
validator_klass.new(*states)
|
57
|
+
elsif superclass.respond_to? :validator
|
58
|
+
superclass.validator.clone
|
59
|
+
|
60
|
+
else
|
61
|
+
NotNaughty::Validator.new
|
62
|
+
|
60
63
|
end
|
61
64
|
end
|
62
65
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: not_naughty
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Florian A\xC3\x9Fmann"
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-03-12 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -27,7 +27,6 @@ files:
|
|
27
27
|
- COPYING
|
28
28
|
- README
|
29
29
|
- Rakefile
|
30
|
-
- doc/rdoc
|
31
30
|
- spec/builder_spec.rb
|
32
31
|
- spec/errors_spec.rb
|
33
32
|
- spec/not_naughty_spec.rb
|