arrayfields 4.7.3 → 4.7.4
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 +4 -4
- data/arrayfields.gemspec +26 -0
- data/gemspec.rb +54 -19
- data/lib/arrayfields.rb +11 -8
- data/readme.rb +248 -0
- metadata +9 -10
- data/README.tmpl +0 -195
- data/arrayfields-4.7.3.gem +0 -0
- data/gen_readme.rb +0 -32
data/README
CHANGED
@@ -2,7 +2,6 @@ NAME
|
|
2
2
|
arrayfields.rb
|
3
3
|
|
4
4
|
URIS
|
5
|
-
http://www.codeforpeople.com/lib/ruby/
|
6
5
|
http://rubyforge.org/projects/codeforpeople/
|
7
6
|
|
8
7
|
SYNOPSIS
|
@@ -86,7 +85,7 @@ LIST OF ADDED Array CLASS METHODS
|
|
86
85
|
Array.fields/Array.struct
|
87
86
|
|
88
87
|
SAMPLES
|
89
|
-
|
88
|
+
|
90
89
|
<========< sample/a.rb >========>
|
91
90
|
|
92
91
|
~ > cat sample/a.rb
|
@@ -268,12 +267,13 @@ SAMPLES
|
|
268
267
|
"bar"
|
269
268
|
|
270
269
|
|
270
|
+
|
271
271
|
AUTHOR
|
272
272
|
ara.t.howard@gmail.com
|
273
273
|
|
274
274
|
HISTORY
|
275
|
-
4.7.
|
276
|
-
-
|
275
|
+
4.7.4
|
276
|
+
- fixes for clone/dup methods
|
277
277
|
|
278
278
|
4.6.0
|
279
279
|
- Array#fields getter acts as setter if arg given, eg
|
data/arrayfields.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
### gemspec: arrayfields-4.7.4
|
2
|
+
|
3
|
+
Gem::Specification::new do |spec|
|
4
|
+
spec.name = "arrayfields"
|
5
|
+
spec.version = "4.7.4"
|
6
|
+
spec.platform = Gem::Platform::RUBY
|
7
|
+
spec.summary = "arrayfields"
|
8
|
+
|
9
|
+
spec.files = ["arrayfields.gemspec", "gemspec.rb", "install.rb", "lib", "lib/arrayfields.rb", "README", "readme.rb", "sample", "sample/a.rb", "sample/b.rb", "sample/c.rb", "sample/d.rb", "sample/e.rb", "test", "test/arrayfields.rb", "test/memtest.rb"]
|
10
|
+
spec.executables = []
|
11
|
+
|
12
|
+
spec.require_path = "lib"
|
13
|
+
|
14
|
+
spec.has_rdoc = true
|
15
|
+
spec.test_files = "test/arrayfields.rb"
|
16
|
+
#spec.add_dependency 'lib', '>= version'
|
17
|
+
#spec.add_dependency 'fattr'
|
18
|
+
|
19
|
+
spec.extensions.push(*[])
|
20
|
+
|
21
|
+
spec.rubyforge_project = 'codeforpeople'
|
22
|
+
spec.author = "Ara T. Howard"
|
23
|
+
spec.email = "ara.t.howard@gmail.com"
|
24
|
+
spec.homepage = "http://github.com/ahoward/arrayfields/tree/master"
|
25
|
+
end
|
26
|
+
|
data/gemspec.rb
CHANGED
@@ -1,27 +1,62 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
1
2
|
|
2
|
-
lib, version =
|
3
|
+
lib, version, *ignored = ARGV
|
3
4
|
|
4
|
-
|
5
|
+
unless lib
|
6
|
+
lib = File.basename(Dir.pwd)
|
7
|
+
end
|
8
|
+
|
9
|
+
unless version
|
10
|
+
mod = lib.capitalize
|
11
|
+
require "./lib/#{ lib }"
|
12
|
+
version = eval(mod).send(:version)
|
13
|
+
end
|
5
14
|
|
6
|
-
|
7
|
-
|
8
|
-
spec.name = lib
|
9
|
-
spec.version = version
|
10
|
-
spec.platform = Gem::Platform::RUBY
|
11
|
-
spec.summary = lib
|
15
|
+
abort('no lib') unless lib
|
16
|
+
abort('no version') unless version
|
12
17
|
|
13
|
-
|
14
|
-
spec.executables = Dir::glob("bin/*").map{|exe| File::basename exe}
|
15
|
-
|
16
|
-
spec.require_path = "lib"
|
17
|
-
spec.autorequire = lib
|
18
|
+
puts "### gemspec: #{ lib }-#{ version }"
|
18
19
|
|
19
|
-
|
20
|
-
spec.test_suite_file = "test/#{ lib }.rb" if File::directory? "test"
|
20
|
+
$VERBOSE = nil
|
21
21
|
|
22
|
-
|
22
|
+
shiteless = lambda{|list| list.delete_if{|file| file =~ %r/\.(git|svn|tmp|sw.|bak)$/}}
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
|
24
|
+
files = shiteless[Dir::glob("**/**")]
|
25
|
+
executables = shiteless[Dir::glob("bin/*")].map{|exe| File.basename(exe)}
|
26
|
+
has_rdoc = true #File.exist?('doc')
|
27
|
+
test_files = "test/#{ lib }.rb" if File.file?("test/#{ lib }.rb")
|
28
|
+
|
29
|
+
extensions = []
|
30
|
+
%w( Makefile configure extconf.rb rakefile Rakefile mkrf_conf ).each do |ext|
|
31
|
+
extensions << ext if File.exists?(ext)
|
27
32
|
end
|
33
|
+
|
34
|
+
template = <<-__
|
35
|
+
|
36
|
+
Gem::Specification::new do |spec|
|
37
|
+
spec.name = #{ lib.inspect }
|
38
|
+
spec.version = #{ version.inspect }
|
39
|
+
spec.platform = Gem::Platform::RUBY
|
40
|
+
spec.summary = #{ lib.inspect }
|
41
|
+
|
42
|
+
spec.files = #{ files.inspect }
|
43
|
+
spec.executables = #{ executables.inspect }
|
44
|
+
|
45
|
+
spec.require_path = "lib"
|
46
|
+
|
47
|
+
spec.has_rdoc = #{ has_rdoc.inspect }
|
48
|
+
spec.test_files = #{ test_files.inspect }
|
49
|
+
#spec.add_dependency 'lib', '>= version'
|
50
|
+
#spec.add_dependency 'fattr'
|
51
|
+
|
52
|
+
spec.extensions.push(*#{ extensions.inspect })
|
53
|
+
|
54
|
+
spec.rubyforge_project = 'codeforpeople'
|
55
|
+
spec.author = "Ara T. Howard"
|
56
|
+
spec.email = "ara.t.howard@gmail.com"
|
57
|
+
spec.homepage = "http://github.com/ahoward/#{ lib }/tree/master"
|
58
|
+
end
|
59
|
+
|
60
|
+
__
|
61
|
+
|
62
|
+
puts template
|
data/lib/arrayfields.rb
CHANGED
@@ -5,8 +5,8 @@
|
|
5
5
|
# Array#fields= is called
|
6
6
|
#
|
7
7
|
module ArrayFields
|
8
|
-
self::VERSION = '4.7.
|
9
|
-
def self.version() VERSION end
|
8
|
+
self::VERSION = '4.7.4' unless defined? self::VERSION
|
9
|
+
def self.version() Arrayfields::VERSION end
|
10
10
|
#
|
11
11
|
# multiton cache of fields - wraps fields and fieldpos map to save memory
|
12
12
|
#
|
@@ -252,14 +252,17 @@
|
|
252
252
|
end
|
253
253
|
alias_method 'pairs', 'to_pairs'
|
254
254
|
|
255
|
-
def
|
256
|
-
|
257
|
-
|
258
|
-
|
255
|
+
def clone
|
256
|
+
clone = super
|
257
|
+
ensure
|
258
|
+
clone.fields = fields.clone
|
259
259
|
end
|
260
260
|
|
261
|
-
|
262
|
-
|
261
|
+
def dup
|
262
|
+
dup = super
|
263
|
+
ensure
|
264
|
+
dup.fields = fields.dup
|
265
|
+
end
|
263
266
|
|
264
267
|
def deepcopy
|
265
268
|
cp = Marshal.load(Marshal.dump(self))
|
data/readme.rb
ADDED
@@ -0,0 +1,248 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
|
3
|
+
template = <<-__
|
4
|
+
NAME
|
5
|
+
arrayfields.rb
|
6
|
+
|
7
|
+
URIS
|
8
|
+
http://rubyforge.org/projects/codeforpeople/
|
9
|
+
|
10
|
+
SYNOPSIS
|
11
|
+
require 'arrayfields'
|
12
|
+
|
13
|
+
a = Arrayfields.new :k, :v, :a, :b
|
14
|
+
|
15
|
+
p a[:k] #=> :v
|
16
|
+
p a[:a] #=> :b
|
17
|
+
p a.fields #=> [:k, :a]
|
18
|
+
p a.values #=> [:v, :b]
|
19
|
+
p a #=> [:v, :b]
|
20
|
+
p a.to_hash #=> {:k => :v, :a => :b}
|
21
|
+
p a.pairs #=> [[:k, :v], [:a, :b]]
|
22
|
+
|
23
|
+
a[:foo] = :bar
|
24
|
+
|
25
|
+
p a[:foo] #=> :bar
|
26
|
+
p a.fields #=> [:k, :a, :foo]
|
27
|
+
|
28
|
+
AND
|
29
|
+
|
30
|
+
require 'arrayfields'
|
31
|
+
|
32
|
+
fields = 'name', 'age'
|
33
|
+
a = [ 'zaphod', 42 ]
|
34
|
+
|
35
|
+
a.fields = fields
|
36
|
+
|
37
|
+
a['name'] #=> 'zaphod'
|
38
|
+
a[:name ] #=> 'zaphod'
|
39
|
+
a.indices 'name', 'age' #=> [ 'zaphod', 42 ]
|
40
|
+
|
41
|
+
DESCRIPTION
|
42
|
+
allow keyword access to array instances. arrayfields works by adding only a
|
43
|
+
few methods to arrays, namely #fields= and fields, but the #fields= method is
|
44
|
+
hooked to extend an array on a per object basis. in otherwords __only__ those
|
45
|
+
arrays whose fields are set will have auto-magical keyword access bestowed on
|
46
|
+
them - all other arrays remain unaffected. arrays with keyword access require
|
47
|
+
much less memory when compared to hashes/objects and yet still provide fast
|
48
|
+
lookup and preserve data order.
|
49
|
+
|
50
|
+
LIST OF OVERRIDDEN METHODS
|
51
|
+
Array#[]
|
52
|
+
Array#slice
|
53
|
+
Array#[]=
|
54
|
+
Array#at
|
55
|
+
Array#delete_at
|
56
|
+
Array#fill
|
57
|
+
Array#values_at
|
58
|
+
Array#indices
|
59
|
+
Array#indexes
|
60
|
+
Array#slice!
|
61
|
+
|
62
|
+
LIST OF HASH-LIKE METHODS
|
63
|
+
Array#each_with_field
|
64
|
+
Array#each_pair
|
65
|
+
Array#each_key
|
66
|
+
Array#each_value
|
67
|
+
Array#fetch
|
68
|
+
Array#has_key?
|
69
|
+
Array#member?
|
70
|
+
Array#key?
|
71
|
+
Array#has_value?
|
72
|
+
Array#value?
|
73
|
+
Array#keys
|
74
|
+
Array#store
|
75
|
+
Array#values
|
76
|
+
Array#to_hash
|
77
|
+
Array#to_h
|
78
|
+
Array#update
|
79
|
+
Array#replace
|
80
|
+
Array#invert
|
81
|
+
Array#pairs
|
82
|
+
|
83
|
+
LIST OF ADDED Array METHODS
|
84
|
+
Array#fields=
|
85
|
+
Array#fields
|
86
|
+
|
87
|
+
LIST OF ADDED Array CLASS METHODS
|
88
|
+
Array.fields/Array.struct
|
89
|
+
|
90
|
+
SAMPLES
|
91
|
+
<%= samples %>
|
92
|
+
|
93
|
+
AUTHOR
|
94
|
+
ara.t.howard@gmail.com
|
95
|
+
|
96
|
+
HISTORY
|
97
|
+
4.7.4
|
98
|
+
- fixes for clone/dup methods
|
99
|
+
|
100
|
+
4.6.0
|
101
|
+
- Array#fields getter acts as setter if arg given, eg
|
102
|
+
|
103
|
+
a = []
|
104
|
+
|
105
|
+
a.fields %w( a b c )
|
106
|
+
a['c'] = 42
|
107
|
+
|
108
|
+
4.4.0:
|
109
|
+
- working dup method worked in, also deepcopy and clone
|
110
|
+
|
111
|
+
4.3.0:
|
112
|
+
- a dup like method, named 'copy' and based on clone, is added to Arrayfields objects
|
113
|
+
|
114
|
+
4.2.0:
|
115
|
+
- a dup impl apparently caused some confusion with both rake and rails, so
|
116
|
+
this release undoes that impl and should be considered a critical bugfix
|
117
|
+
release
|
118
|
+
|
119
|
+
4.1.0:
|
120
|
+
- improved Array.struct method, see sample/e.rb
|
121
|
+
|
122
|
+
4.0.0:
|
123
|
+
- added Arrayfields.new(*arbitrary_evenly_numbered_list_of_objects)
|
124
|
+
- added #to_pairs and #pairs
|
125
|
+
- tried but failed to recall what happend for version 3.8
|
126
|
+
- changed Array.fields to == Arrayfields.new (used to alias Array.struct)
|
127
|
+
- added impl of Fieldable#dup that sets fields in dupped object
|
128
|
+
|
129
|
+
3.7.0:
|
130
|
+
- multiton pattern clean up, thanks gavin kistner!
|
131
|
+
- mods for ruby 1.8.6 (alias bug in 1.8.6 i think)
|
132
|
+
- added PseudoHash class
|
133
|
+
- added Array.struct/fields class generator
|
134
|
+
|
135
|
+
3.6.0:
|
136
|
+
- made string/symbol keys interchangeable
|
137
|
+
|
138
|
+
list = [0, 1, 2]
|
139
|
+
list.fields = %w( a b c )
|
140
|
+
p list['a'] #=> 0
|
141
|
+
p list[:a] #=> 0
|
142
|
+
|
143
|
+
|
144
|
+
3.5.0:
|
145
|
+
- added more hash-like methods
|
146
|
+
- update
|
147
|
+
- replace
|
148
|
+
- invert
|
149
|
+
|
150
|
+
3.4.0:
|
151
|
+
- added FieldedArray[] ctor
|
152
|
+
- added methods to make Arrays with fields set behave more closely to Hashes
|
153
|
+
- each_pair
|
154
|
+
- each_key
|
155
|
+
- each_value
|
156
|
+
- fetch
|
157
|
+
- has_key?
|
158
|
+
- member?
|
159
|
+
- key?
|
160
|
+
- has_value?
|
161
|
+
- value?
|
162
|
+
- keys?
|
163
|
+
- store
|
164
|
+
- values
|
165
|
+
|
166
|
+
3.3.0:
|
167
|
+
- added gemspec file - thnx Assaph Mehr
|
168
|
+
- added FieldedArray proxy class which minimizes modifications to class
|
169
|
+
Array and allow ArrayFields to work (potientially) other arraylike object.
|
170
|
+
thnks Sean O'Dell
|
171
|
+
- added ArrayFields#to_hash method - this seems like an obvious one to add!
|
172
|
+
- remedied bug where using append feature of assigning with unknow field
|
173
|
+
appedended but did not append to acutal fields
|
174
|
+
- added samples
|
175
|
+
- created rubyforge accnt @ http://rubyforge.org/projects/arrayfields/
|
176
|
+
|
177
|
+
3.2.0:
|
178
|
+
- precedence fix in many methods - thnx. nobu
|
179
|
+
- test for #slice! were not being run - corrected
|
180
|
+
- added test for appeding via "a['new_field'] = 42"
|
181
|
+
|
182
|
+
3.1.0:
|
183
|
+
- added FieldSet class to reduce ram - thnx. Kirk Haines for profiliing
|
184
|
+
memory and prompting this change
|
185
|
+
|
186
|
+
- interface changed every so slightly so
|
187
|
+
|
188
|
+
a.fields = 'a', 'b', 'c'
|
189
|
+
|
190
|
+
is not allowed. use
|
191
|
+
|
192
|
+
a.fields = %w(a b c)
|
193
|
+
|
194
|
+
or
|
195
|
+
|
196
|
+
a.fields = ['a', 'b', 'c']
|
197
|
+
|
198
|
+
|
199
|
+
3.0.0:
|
200
|
+
- added unit tests
|
201
|
+
__
|
202
|
+
|
203
|
+
|
204
|
+
require 'erb'
|
205
|
+
require 'pathname'
|
206
|
+
|
207
|
+
$VERBOSE=nil
|
208
|
+
|
209
|
+
def indent(s, n = 2)
|
210
|
+
s = unindent(s)
|
211
|
+
ws = ' ' * n
|
212
|
+
s.gsub(%r/^/, ws)
|
213
|
+
end
|
214
|
+
|
215
|
+
def unindent(s)
|
216
|
+
indent = nil
|
217
|
+
s.each do |line|
|
218
|
+
next if line =~ %r/^\s*$/
|
219
|
+
indent = line[%r/^\s*/] and break
|
220
|
+
end
|
221
|
+
indent ? s.gsub(%r/^#{ indent }/, "") : s
|
222
|
+
end
|
223
|
+
|
224
|
+
samples = ''
|
225
|
+
prompt = '~ > '
|
226
|
+
|
227
|
+
Dir.chdir(File.dirname(__FILE__))
|
228
|
+
|
229
|
+
Dir['sample*/*'].sort.each do |sample|
|
230
|
+
samples << "\n" << " <========< #{ sample } >========>" << "\n\n"
|
231
|
+
|
232
|
+
cmd = "cat #{ sample }"
|
233
|
+
samples << indent(prompt + cmd, 2) << "\n\n"
|
234
|
+
samples << indent(`#{ cmd }`, 4) << "\n"
|
235
|
+
|
236
|
+
cmd = "ruby #{ sample }"
|
237
|
+
samples << indent(prompt + cmd, 2) << "\n\n"
|
238
|
+
|
239
|
+
cmd = "ruby -e'STDOUT.sync=true; exec %(ruby -Ilib #{ sample })'"
|
240
|
+
#cmd = "ruby -Ilib #{ sample }"
|
241
|
+
samples << indent(`#{ cmd } 2>&1`, 4) << "\n"
|
242
|
+
end
|
243
|
+
|
244
|
+
erb = ERB.new(unindent(template))
|
245
|
+
result = erb.result(binding)
|
246
|
+
#open('README', 'w'){|fd| fd.write result}
|
247
|
+
#puts unindent(result)
|
248
|
+
puts result
|
metadata
CHANGED
@@ -1,20 +1,20 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arrayfields
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.7.
|
4
|
+
version: 4.7.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ara T. Howard
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-06-05 00:00:00 -06:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
16
16
|
description:
|
17
|
-
email: ara.t.howard@
|
17
|
+
email: ara.t.howard@gmail.com
|
18
18
|
executables: []
|
19
19
|
|
20
20
|
extensions: []
|
@@ -22,14 +22,13 @@ extensions: []
|
|
22
22
|
extra_rdoc_files: []
|
23
23
|
|
24
24
|
files:
|
25
|
-
- arrayfields
|
25
|
+
- arrayfields.gemspec
|
26
26
|
- gemspec.rb
|
27
|
-
- gen_readme.rb
|
28
27
|
- install.rb
|
29
28
|
- lib
|
30
29
|
- lib/arrayfields.rb
|
31
30
|
- README
|
32
|
-
-
|
31
|
+
- readme.rb
|
33
32
|
- sample
|
34
33
|
- sample/a.rb
|
35
34
|
- sample/b.rb
|
@@ -39,8 +38,8 @@ files:
|
|
39
38
|
- test
|
40
39
|
- test/arrayfields.rb
|
41
40
|
- test/memtest.rb
|
42
|
-
has_rdoc:
|
43
|
-
homepage: http://
|
41
|
+
has_rdoc: true
|
42
|
+
homepage: http://github.com/ahoward/arrayfields/tree/master
|
44
43
|
post_install_message:
|
45
44
|
rdoc_options: []
|
46
45
|
|
@@ -60,7 +59,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
60
59
|
version:
|
61
60
|
requirements: []
|
62
61
|
|
63
|
-
rubyforge_project:
|
62
|
+
rubyforge_project: codeforpeople
|
64
63
|
rubygems_version: 1.3.1
|
65
64
|
signing_key:
|
66
65
|
specification_version: 2
|
data/README.tmpl
DELETED
@@ -1,195 +0,0 @@
|
|
1
|
-
NAME
|
2
|
-
arrayfields.rb
|
3
|
-
|
4
|
-
URIS
|
5
|
-
http://www.codeforpeople.com/lib/ruby/
|
6
|
-
http://rubyforge.org/projects/codeforpeople/
|
7
|
-
|
8
|
-
SYNOPSIS
|
9
|
-
require 'arrayfields'
|
10
|
-
|
11
|
-
a = Arrayfields.new :k, :v, :a, :b
|
12
|
-
|
13
|
-
p a[:k] #=> :v
|
14
|
-
p a[:a] #=> :b
|
15
|
-
p a.fields #=> [:k, :a]
|
16
|
-
p a.values #=> [:v, :b]
|
17
|
-
p a #=> [:v, :b]
|
18
|
-
p a.to_hash #=> {:k => :v, :a => :b}
|
19
|
-
p a.pairs #=> [[:k, :v], [:a, :b]]
|
20
|
-
|
21
|
-
a[:foo] = :bar
|
22
|
-
|
23
|
-
p a[:foo] #=> :bar
|
24
|
-
p a.fields #=> [:k, :a, :foo]
|
25
|
-
|
26
|
-
AND
|
27
|
-
|
28
|
-
require 'arrayfields'
|
29
|
-
|
30
|
-
fields = 'name', 'age'
|
31
|
-
a = [ 'zaphod', 42 ]
|
32
|
-
|
33
|
-
a.fields = fields
|
34
|
-
|
35
|
-
a['name'] #=> 'zaphod'
|
36
|
-
a[:name ] #=> 'zaphod'
|
37
|
-
a.indices 'name', 'age' #=> [ 'zaphod', 42 ]
|
38
|
-
|
39
|
-
DESCRIPTION
|
40
|
-
allow keyword access to array instances. arrayfields works by adding only a
|
41
|
-
few methods to arrays, namely #fields= and fields, but the #fields= method is
|
42
|
-
hooked to extend an array on a per object basis. in otherwords __only__ those
|
43
|
-
arrays whose fields are set will have auto-magical keyword access bestowed on
|
44
|
-
them - all other arrays remain unaffected. arrays with keyword access require
|
45
|
-
much less memory when compared to hashes/objects and yet still provide fast
|
46
|
-
lookup and preserve data order.
|
47
|
-
|
48
|
-
LIST OF OVERRIDDEN METHODS
|
49
|
-
Array#[]
|
50
|
-
Array#slice
|
51
|
-
Array#[]=
|
52
|
-
Array#at
|
53
|
-
Array#delete_at
|
54
|
-
Array#fill
|
55
|
-
Array#values_at
|
56
|
-
Array#indices
|
57
|
-
Array#indexes
|
58
|
-
Array#slice!
|
59
|
-
|
60
|
-
LIST OF HASH-LIKE METHODS
|
61
|
-
Array#each_with_field
|
62
|
-
Array#each_pair
|
63
|
-
Array#each_key
|
64
|
-
Array#each_value
|
65
|
-
Array#fetch
|
66
|
-
Array#has_key?
|
67
|
-
Array#member?
|
68
|
-
Array#key?
|
69
|
-
Array#has_value?
|
70
|
-
Array#value?
|
71
|
-
Array#keys
|
72
|
-
Array#store
|
73
|
-
Array#values
|
74
|
-
Array#to_hash
|
75
|
-
Array#to_h
|
76
|
-
Array#update
|
77
|
-
Array#replace
|
78
|
-
Array#invert
|
79
|
-
Array#pairs
|
80
|
-
|
81
|
-
LIST OF ADDED Array METHODS
|
82
|
-
Array#fields=
|
83
|
-
Array#fields
|
84
|
-
|
85
|
-
LIST OF ADDED Array CLASS METHODS
|
86
|
-
Array.fields/Array.struct
|
87
|
-
|
88
|
-
SAMPLES
|
89
|
-
@samples
|
90
|
-
|
91
|
-
AUTHOR
|
92
|
-
ara.t.howard@gmail.com
|
93
|
-
|
94
|
-
HISTORY
|
95
|
-
4.6.0
|
96
|
-
- Array#fields getter acts as setter if arg given, eg
|
97
|
-
|
98
|
-
a = []
|
99
|
-
|
100
|
-
a.fields %w( a b c )
|
101
|
-
a['c'] = 42
|
102
|
-
|
103
|
-
4.4.0:
|
104
|
-
- working dup method worked in, also deepcopy and clone
|
105
|
-
|
106
|
-
4.3.0:
|
107
|
-
- a dup like method, named 'copy' and based on clone, is added to Arrayfields objects
|
108
|
-
|
109
|
-
4.2.0:
|
110
|
-
- a dup impl apparently caused some confusion with both rake and rails, so
|
111
|
-
this release undoes that impl and should be considered a critical bugfix
|
112
|
-
release
|
113
|
-
|
114
|
-
4.1.0:
|
115
|
-
- improved Array.struct method, see sample/e.rb
|
116
|
-
|
117
|
-
4.0.0:
|
118
|
-
- added Arrayfields.new(*arbitrary_evenly_numbered_list_of_objects)
|
119
|
-
- added #to_pairs and #pairs
|
120
|
-
- tried but failed to recall what happend for version 3.8
|
121
|
-
- changed Array.fields to == Arrayfields.new (used to alias Array.struct)
|
122
|
-
- added impl of Fieldable#dup that sets fields in dupped object
|
123
|
-
|
124
|
-
3.7.0:
|
125
|
-
- multiton pattern clean up, thanks gavin kistner!
|
126
|
-
- mods for ruby 1.8.6 (alias bug in 1.8.6 i think)
|
127
|
-
- added PseudoHash class
|
128
|
-
- added Array.struct/fields class generator
|
129
|
-
|
130
|
-
3.6.0:
|
131
|
-
- made string/symbol keys interchangeable
|
132
|
-
|
133
|
-
list = [0, 1, 2]
|
134
|
-
list.fields = %w( a b c )
|
135
|
-
p list['a'] #=> 0
|
136
|
-
p list[:a] #=> 0
|
137
|
-
|
138
|
-
|
139
|
-
3.5.0:
|
140
|
-
- added more hash-like methods
|
141
|
-
- update
|
142
|
-
- replace
|
143
|
-
- invert
|
144
|
-
|
145
|
-
3.4.0:
|
146
|
-
- added FieldedArray[] ctor
|
147
|
-
- added methods to make Arrays with fields set behave more closely to Hashes
|
148
|
-
- each_pair
|
149
|
-
- each_key
|
150
|
-
- each_value
|
151
|
-
- fetch
|
152
|
-
- has_key?
|
153
|
-
- member?
|
154
|
-
- key?
|
155
|
-
- has_value?
|
156
|
-
- value?
|
157
|
-
- keys?
|
158
|
-
- store
|
159
|
-
- values
|
160
|
-
|
161
|
-
3.3.0:
|
162
|
-
- added gemspec file - thnx Assaph Mehr
|
163
|
-
- added FieldedArray proxy class which minimizes modifications to class
|
164
|
-
Array and allow ArrayFields to work (potientially) other arraylike object.
|
165
|
-
thnks Sean O'Dell
|
166
|
-
- added ArrayFields#to_hash method - this seems like an obvious one to add!
|
167
|
-
- remedied bug where using append feature of assigning with unknow field
|
168
|
-
appedended but did not append to acutal fields
|
169
|
-
- added samples
|
170
|
-
- created rubyforge accnt @ http://rubyforge.org/projects/arrayfields/
|
171
|
-
|
172
|
-
3.2.0:
|
173
|
-
- precedence fix in many methods - thnx. nobu
|
174
|
-
- test for #slice! were not being run - corrected
|
175
|
-
- added test for appeding via "a['new_field'] = 42"
|
176
|
-
|
177
|
-
3.1.0:
|
178
|
-
- added FieldSet class to reduce ram - thnx. Kirk Haines for profiliing
|
179
|
-
memory and prompting this change
|
180
|
-
|
181
|
-
- interface changed every so slightly so
|
182
|
-
|
183
|
-
a.fields = 'a', 'b', 'c'
|
184
|
-
|
185
|
-
is not allowed. use
|
186
|
-
|
187
|
-
a.fields = %w(a b c)
|
188
|
-
|
189
|
-
or
|
190
|
-
|
191
|
-
a.fields = ['a', 'b', 'c']
|
192
|
-
|
193
|
-
|
194
|
-
3.0.0:
|
195
|
-
- added unit tests
|
data/arrayfields-4.7.3.gem
DELETED
File without changes
|
data/gen_readme.rb
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
require 'pathname'
|
2
|
-
|
3
|
-
$VERBOSE=nil
|
4
|
-
|
5
|
-
def indent s, n = 2
|
6
|
-
ws = ' ' * n
|
7
|
-
s.gsub %r/^/, ws
|
8
|
-
end
|
9
|
-
|
10
|
-
template = IO::read 'README.tmpl'
|
11
|
-
|
12
|
-
samples = ''
|
13
|
-
prompt = '~ > '
|
14
|
-
|
15
|
-
Dir['sample*/*'].sort.each do |sample|
|
16
|
-
samples << "\n" << " <========< #{ sample } >========>" << "\n\n"
|
17
|
-
|
18
|
-
cmd = "cat #{ sample }"
|
19
|
-
samples << indent(prompt + cmd, 2) << "\n\n"
|
20
|
-
samples << indent(`#{ cmd }`, 4) << "\n"
|
21
|
-
|
22
|
-
cmd = "ruby #{ sample }"
|
23
|
-
samples << indent(prompt + cmd, 2) << "\n\n"
|
24
|
-
|
25
|
-
cmd = "ruby -Ilib #{ sample }"
|
26
|
-
samples << indent(`#{ cmd } 2>&1`, 4) << "\n"
|
27
|
-
end
|
28
|
-
|
29
|
-
#samples.gsub! %r/^/, ' '
|
30
|
-
|
31
|
-
readme = template.gsub %r/^\s*@samples\s*$/, samples
|
32
|
-
print readme
|