wedge 0.1.19 → 0.1.20
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.
- checksums.yaml +4 -4
- data/lib/wedge/plugins/form.rb +5 -0
- data/lib/wedge/plugins/form/validations.rb +4 -4
- data/lib/wedge/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 164e8c7334f161e44b6a9770b12ed5a8e5d6be0d
|
4
|
+
data.tar.gz: b7db45c79f2c49cc7238742a66623ddd141bd2ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e478d89243b932942747ed53637b06d2e821475cf7d167b3d7efb109dfe1290a791a44db4fa9bfabed2ff00791cad6195bef947c07ceb6dfb8f500d62dbf7ef
|
7
|
+
data.tar.gz: e81c3747ba066a1365ee620dcd703a7a54a6ce39cce2b37b24bd04eaece714b0cf55d688fa4319893b1fa432fcf72cbcb033379f74534c46f9cce3285298ca7a
|
data/lib/wedge/plugins/form.rb
CHANGED
@@ -9,6 +9,8 @@ class Wedge
|
|
9
9
|
include Methods
|
10
10
|
include Validations
|
11
11
|
include Render
|
12
|
+
include Enumerable
|
13
|
+
extend Forwardable
|
12
14
|
|
13
15
|
# This allows us to call super
|
14
16
|
module Delegates
|
@@ -310,6 +312,9 @@ class Wedge
|
|
310
312
|
end
|
311
313
|
end
|
312
314
|
end
|
315
|
+
|
316
|
+
# define #each
|
317
|
+
def_delegators :attributes, :each
|
313
318
|
end
|
314
319
|
end
|
315
320
|
end
|
@@ -120,7 +120,7 @@ class Wedge
|
|
120
120
|
# when the validation fails.
|
121
121
|
def assert_format(att, format, error = [att, :format])
|
122
122
|
if !send(att).to_s.empty?
|
123
|
-
assert(
|
123
|
+
assert(atts.send(att).to_s.match(format), error)
|
124
124
|
end
|
125
125
|
end
|
126
126
|
|
@@ -196,12 +196,12 @@ class Wedge
|
|
196
196
|
end
|
197
197
|
|
198
198
|
def assert_member(att, set, err = [att, :not_valid])
|
199
|
-
assert(set.include?(
|
199
|
+
assert(set.include?(atts.send(att)), err)
|
200
200
|
end
|
201
201
|
|
202
202
|
def assert_length(att, range, error = [att, :not_in_range])
|
203
203
|
if !send(att).to_s.empty?
|
204
|
-
val =
|
204
|
+
val = atts.send(att).to_s
|
205
205
|
assert range.include?(val.length), error
|
206
206
|
end
|
207
207
|
end
|
@@ -234,7 +234,7 @@ class Wedge
|
|
234
234
|
# @param [Array<Symbol, Symbol>] error The error that should be returned
|
235
235
|
# when the validation fails.
|
236
236
|
def assert_equal(att, value, error = [att, :not_equal])
|
237
|
-
assert value ===
|
237
|
+
assert value === atts.send(att), error
|
238
238
|
end
|
239
239
|
|
240
240
|
# The grand daddy of all assertions. If you want to build custom
|
data/lib/wedge/version.rb
CHANGED