valid_array 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.rdoc +3 -3
- data/lib/valid_array/functions.rb +1 -1
- data/spec/valid_array_spec.rb +20 -1
- metadata +12 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5540bbeb5c0797896e74cb1fdc507f49223d911
|
4
|
+
data.tar.gz: f12f26002857b457e54b079969b05864ec036cf3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bdf737b17919078f38e37a0de09805de7e4c304ac2da8ab7d222489ba91cd22ed4a4f97687e04340e77b5ae048db8e7100a8ea876bf72b4e25bf974a87fc05ff
|
7
|
+
data.tar.gz: 6b166c70949b2ca1ff71edf2dc01bbe09a0f09e51825fd4a43c3fdd48984ad67d118bb8ddcb8b9f30e83db31673d5e9d159e177a463d5a8d471b222c36495275
|
data/README.rdoc
CHANGED
@@ -8,9 +8,9 @@ vaild_array also provides compatibility with the typed-array gem. There is both
|
|
8
8
|
'valid_array/typed_array' which imports to `ValidArray::TypedArray` and a fully
|
9
9
|
compatible 'valid-array' which passes 'valid-array's own test suite.
|
10
10
|
|
11
|
-
Copyright (c) 2011 Ryan Biesemeyer <mailto:ruby-dev@yaauie.com> (Original typed-array work)
|
12
|
-
Copyright (c) 2013 Kevin Cox <mailto:kevincox@kevincox.ca>
|
13
|
-
See LICENSE for details.
|
11
|
+
- Copyright (c) 2011 Ryan Biesemeyer <mailto:ruby-dev@yaauie.com> (Original typed-array work)
|
12
|
+
- Copyright (c) 2013 Kevin Cox <mailto:kevincox@kevincox.ca>
|
13
|
+
- See LICENSE for details.
|
14
14
|
|
15
15
|
== Examples
|
16
16
|
|
data/spec/valid_array_spec.rb
CHANGED
@@ -1,6 +1,13 @@
|
|
1
1
|
require_relative 'spec_helper'
|
2
2
|
require 'valid_array'
|
3
3
|
|
4
|
+
class StringArray < Array
|
5
|
+
extend ValidArray
|
6
|
+
def self.validate(e)
|
7
|
+
e.to_s
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
4
11
|
describe ValidArray do
|
5
12
|
context 'when custom validator is used' do
|
6
13
|
before :each do
|
@@ -20,7 +27,19 @@ describe ValidArray do
|
|
20
27
|
end
|
21
28
|
end
|
22
29
|
end
|
23
|
-
|
30
|
+
|
31
|
+
context 'when array is modified' do
|
32
|
+
it 'should convert contat arguments' do
|
33
|
+
a = StringArray.new
|
34
|
+
|
35
|
+
a.concat [1,2,3]
|
36
|
+
a.should eql(['1','2','3'])
|
37
|
+
|
38
|
+
a.concat [4,5,6]
|
39
|
+
a.should eql(['1','2','3','4','5','6'])
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
24
43
|
context 'when custom validator is used' do
|
25
44
|
before :each do
|
26
45
|
class MyArray < Array
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: valid_array
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Cox
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-10-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rdoc
|
@@ -25,10 +25,14 @@ dependencies:
|
|
25
25
|
- - ~>
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '3.9'
|
28
|
-
description:
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
description: |
|
29
|
+
The valid_array gem provides to create an Array that enforces certian
|
30
|
+
properties. Each element added to the array is passed to a validator function
|
31
|
+
written by you. This function can raise errors, drop items or change them.
|
32
|
+
|
33
|
+
vaild_array also provides compatibility with the typed-array gem. There is both
|
34
|
+
'valid_array/typed_array' which imports to `ValidArray::TypedArray` and a fully
|
35
|
+
compatible 'valid-array' which passes 'valid-array's own test suite.
|
32
36
|
email: kevincox@kevincox.ca
|
33
37
|
executables: []
|
34
38
|
extensions: []
|
@@ -46,7 +50,7 @@ files:
|
|
46
50
|
- spec/typed_array_spec.rb
|
47
51
|
- LICENSE
|
48
52
|
- README.rdoc
|
49
|
-
homepage: http://github.com/kevincox/
|
53
|
+
homepage: http://github.com/kevincox/valid_array
|
50
54
|
licenses:
|
51
55
|
- MIT
|
52
56
|
metadata: {}
|
@@ -69,6 +73,6 @@ rubyforge_project:
|
|
69
73
|
rubygems_version: 2.0.3
|
70
74
|
signing_key:
|
71
75
|
specification_version: 1
|
72
|
-
summary: Provides methods for
|
76
|
+
summary: Provides methods for controlling the elements added to an array.
|
73
77
|
test_files: []
|
74
78
|
has_rdoc:
|