arrayfields 4.4.0 → 4.5.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 +7 -7
- data/arrayfields-4.5.0.gem +0 -0
- data/lib/{arrayfields-4.4.0.rb → arrayfields-4.5.0.rb} +1 -1
- data/lib/arrayfields.rb +1 -1
- data/sample/a.rb +1 -2
- data/sample/c.rb +1 -1
- data/sample/d.rb +5 -4
- metadata +3 -2
data/README
CHANGED
@@ -112,8 +112,7 @@ SAMPLES
|
|
112
112
|
# assigmnet is allowed
|
113
113
|
#
|
114
114
|
a['zero'] = 42
|
115
|
-
p a['zero'] #=>
|
116
|
-
a['zero'] = 0
|
115
|
+
p a['zero'] #=> 42
|
117
116
|
#
|
118
117
|
# assignment to non-fields results in the element being appended and the field
|
119
118
|
# being added for future use (also appended)
|
@@ -183,7 +182,7 @@ SAMPLES
|
|
183
182
|
|
184
183
|
require 'arrayfields'
|
185
184
|
#
|
186
|
-
# the Array.fields methods generates an
|
185
|
+
# the Array.fields methods generates an instance with those fields
|
187
186
|
#
|
188
187
|
a = Array.fields :a, :b, :c
|
189
188
|
a[:a] = a[:c] = 42
|
@@ -205,21 +204,22 @@ SAMPLES
|
|
205
204
|
require 'arrayfields'
|
206
205
|
#
|
207
206
|
# the Arrayfields.new method is a contruct that takes evenly numbered pairs of
|
208
|
-
# arbitrary objects and builds up
|
207
|
+
# arbitrary objects and builds up a fielded array
|
209
208
|
#
|
210
209
|
a = Arrayfields.new :key, :value, :a, :b
|
211
210
|
p a.fields #=> [:key, :a]
|
212
211
|
p a.values #=> [:value, :b]
|
213
212
|
#
|
214
213
|
# you can use a hash - but of course the ordering gets lost in the initial
|
215
|
-
# hash creation. aka the order of fields get horked by the unorderedness
|
216
|
-
#
|
214
|
+
# hash creation. aka the order of fields get horked by the unorderedness of
|
215
|
+
# ruby's hash iteration. it's okay for some purposes though
|
217
216
|
#
|
218
217
|
a = Arrayfields.new :key => :value, :a => :b
|
219
218
|
p a.fields #=> [:key, :a]
|
220
219
|
p a.values #=> [:value, :b]
|
221
220
|
#
|
222
|
-
# lists of pairs get flattened - the
|
221
|
+
# lists of pairs get flattened - the argument simply has to be evenly numbered
|
222
|
+
# afterwards.
|
223
223
|
#
|
224
224
|
a = Arrayfields.new [[:key, :value], [:a, :b]]
|
225
225
|
p a.fields #=> [:key, :a]
|
File without changes
|
@@ -5,7 +5,7 @@
|
|
5
5
|
# Array#fields= is called
|
6
6
|
#
|
7
7
|
module ArrayFields
|
8
|
-
self::VERSION = '4.
|
8
|
+
self::VERSION = '4.5.0' unless defined? self::VERSION
|
9
9
|
def self.version() VERSION end
|
10
10
|
#
|
11
11
|
# multiton cache of fields - wraps fields and fieldpos map to save memory
|
data/lib/arrayfields.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
# Array#fields= is called
|
6
6
|
#
|
7
7
|
module ArrayFields
|
8
|
-
self::VERSION = '4.
|
8
|
+
self::VERSION = '4.5.0' unless defined? self::VERSION
|
9
9
|
def self.version() VERSION end
|
10
10
|
#
|
11
11
|
# multiton cache of fields - wraps fields and fieldpos map to save memory
|
data/sample/a.rb
CHANGED
@@ -19,8 +19,7 @@ require 'arrayfields'
|
|
19
19
|
# assigmnet is allowed
|
20
20
|
#
|
21
21
|
a['zero'] = 42
|
22
|
-
p a['zero'] #=>
|
23
|
-
a['zero'] = 0
|
22
|
+
p a['zero'] #=> 42
|
24
23
|
#
|
25
24
|
# assignment to non-fields results in the element being appended and the field
|
26
25
|
# being added for future use (also appended)
|
data/sample/c.rb
CHANGED
data/sample/d.rb
CHANGED
@@ -1,21 +1,22 @@
|
|
1
1
|
require 'arrayfields'
|
2
2
|
#
|
3
3
|
# the Arrayfields.new method is a contruct that takes evenly numbered pairs of
|
4
|
-
# arbitrary objects and builds up
|
4
|
+
# arbitrary objects and builds up a fielded array
|
5
5
|
#
|
6
6
|
a = Arrayfields.new :key, :value, :a, :b
|
7
7
|
p a.fields #=> [:key, :a]
|
8
8
|
p a.values #=> [:value, :b]
|
9
9
|
#
|
10
10
|
# you can use a hash - but of course the ordering gets lost in the initial
|
11
|
-
# hash creation. aka the order of fields get horked by the unorderedness
|
12
|
-
#
|
11
|
+
# hash creation. aka the order of fields get horked by the unorderedness of
|
12
|
+
# ruby's hash iteration. it's okay for some purposes though
|
13
13
|
#
|
14
14
|
a = Arrayfields.new :key => :value, :a => :b
|
15
15
|
p a.fields #=> [:key, :a]
|
16
16
|
p a.values #=> [:value, :b]
|
17
17
|
#
|
18
|
-
# lists of pairs get flattened - the
|
18
|
+
# lists of pairs get flattened - the argument simply has to be evenly numbered
|
19
|
+
# afterwards.
|
19
20
|
#
|
20
21
|
a = Arrayfields.new [[:key, :value], [:a, :b]]
|
21
22
|
p a.fields #=> [:key, :a]
|
metadata
CHANGED
@@ -3,7 +3,7 @@ rubygems_version: 0.9.2
|
|
3
3
|
specification_version: 1
|
4
4
|
name: arrayfields
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 4.
|
6
|
+
version: 4.5.0
|
7
7
|
date: 2007-09-18 00:00:00 -06:00
|
8
8
|
summary: arrayfields
|
9
9
|
require_paths:
|
@@ -30,11 +30,12 @@ authors:
|
|
30
30
|
- Ara T. Howard
|
31
31
|
files:
|
32
32
|
- a.rb
|
33
|
+
- arrayfields-4.5.0.gem
|
33
34
|
- gemspec.rb
|
34
35
|
- gen_readme.rb
|
35
36
|
- install.rb
|
36
37
|
- lib
|
37
|
-
- lib/arrayfields-4.
|
38
|
+
- lib/arrayfields-4.5.0.rb
|
38
39
|
- lib/arrayfields.rb
|
39
40
|
- README
|
40
41
|
- README.tmpl
|