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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7f027291bafabc6977571d06cae40b0a19a00ed6
4
- data.tar.gz: 8c62dab2888b7419ecc7466243ad6b08bfdc67d7
3
+ metadata.gz: e5540bbeb5c0797896e74cb1fdc507f49223d911
4
+ data.tar.gz: f12f26002857b457e54b079969b05864ec036cf3
5
5
  SHA512:
6
- metadata.gz: 76bfde39f3b266ad440d05b035f2d91d93d63cd8e0c527f467d33d3d3614fde44f60f4194507d45bd06273a4d5bf51821c14eeb8ed6a0f553618887ea3bbd7dd
7
- data.tar.gz: 4b9c64dbd30920a626d8844b92d8b5ec0af9ac9ebcd3ed75374074599d411efc8a3fe98ce6694a16dd4c89b901bf2e1511428431f96c2862c96bc4b21210b737
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
 
@@ -60,7 +60,7 @@ module ValidArray
60
60
 
61
61
  # Validates outcome. See Array#concat
62
62
  def concat(other_ary)
63
- _ensure_array_is_valid other_ary
63
+ other_ary = _ensure_array_is_valid other_ary
64
64
  super
65
65
  end
66
66
 
@@ -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.0
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-08-28 00:00:00.000000000 Z
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: "\t\tAll methods that alter the contents of an array that implements
29
- this\n\t\tGem are first checked to ensure that the added items are of the types\n\t\tallowed.
30
- All methods behave exactly as their Array counterparts,\n\t\tincluding additional
31
- forms, block processing, etc.\n"
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/valid-array
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 creating type-enforced Arrays
76
+ summary: Provides methods for controlling the elements added to an array.
73
77
  test_files: []
74
78
  has_rdoc: