sequel_sexy_validations 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +1 -1
- data/VERSION +1 -1
- data/lib/sequel_sexy_validations.rb +17 -0
- data/sequel_sexy_validations.gemspec +2 -2
- metadata +3 -3
data/README.rdoc
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
0.1.0
|
@@ -3,12 +3,29 @@ module Sequel
|
|
3
3
|
module SexyValidations
|
4
4
|
|
5
5
|
def self.apply(model, opts={}, &block)
|
6
|
+
model.send(:include, ::SexyValidations)
|
6
7
|
end
|
7
8
|
|
8
9
|
def self.configure(model, opts={}, &block)
|
9
10
|
end
|
10
11
|
|
11
12
|
module ClassMethods
|
13
|
+
def validates(attribute = nil, validations = nil, &block)
|
14
|
+
if validations
|
15
|
+
case validations[:if]
|
16
|
+
when :new
|
17
|
+
validations[:if] = lambda { |record| record.new? }
|
18
|
+
end
|
19
|
+
|
20
|
+
case validations[:unless]
|
21
|
+
when :new
|
22
|
+
validations[:unless] = lambda { |record| record.new? }
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
super(attribute, validations, &block)
|
27
|
+
end
|
28
|
+
|
12
29
|
def load_validator(name)
|
13
30
|
begin
|
14
31
|
require "sequel_sexy_validations/validators/#{name}"
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{sequel_sexy_validations}
|
8
|
-
s.version = "0.0
|
8
|
+
s.version = "0.1.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Corin Langosch"]
|
12
|
-
s.date = %q{2010-09-
|
12
|
+
s.date = %q{2010-09-14}
|
13
13
|
s.description = %q{Sequel plugin which provides sexy validations for model.}
|
14
14
|
s.email = %q{info@netskin.com}
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
- 0
|
8
7
|
- 1
|
9
|
-
|
8
|
+
- 0
|
9
|
+
version: 0.1.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Corin Langosch
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-09-
|
17
|
+
date: 2010-09-14 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|