facets 2.0.4 → 2.0.5
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/RELEASE +10 -4
- data/lib/core/facets/class/initializer.rb +2 -32
- data/lib/core/facets/hash/op.rb +1 -0
- data/lib/core/facets/kernel/report.rb +28 -8
- data/lib/more/facets/dictionary.rb +1 -1
- data/meta/{facets-2.0.4.roll → facets-2.0.5.roll} +0 -0
- data/meta/icli.yaml +2 -2
- data/meta/manifest.txt +1 -1
- data/test/unit/class/test_initializer.rb +23 -31
- metadata +28 -28
data/RELEASE
CHANGED
@@ -1,6 +1,12 @@
|
|
1
|
-
|
1
|
+
Facets 2.0.5 is in the wild!
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
This is an bug-fix release.
|
4
|
+
|
5
|
+
* Fixes bug with Dictionary#initialize
|
6
|
+
* Fixes bug with Hash#-
|
7
|
+
* Also improves changelog production.
|
8
|
+
|
9
|
+
Also included are some final methods, contributed
|
10
|
+
by Noah Gibbs, that hadn't yet been adopted from
|
11
|
+
Gavin Sinclair's Extensions project.
|
6
12
|
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
class Class
|
3
2
|
|
4
3
|
# Automatically create an initializer assigning the given
|
@@ -23,44 +22,15 @@ class Class
|
|
23
22
|
# does not supply a value for each instance variable. In that
|
24
23
|
# case it will just set the instance variable to nil. You can
|
25
24
|
# assign default values or raise an Exception in the block.
|
26
|
-
|
25
|
+
|
27
26
|
def initializer(*attributes, &block)
|
28
27
|
define_method(:initialize) do |*args|
|
29
28
|
attributes.zip(args) do |sym, value|
|
30
29
|
instance_variable_set("@#{sym}", value)
|
31
30
|
end
|
32
|
-
|
33
31
|
instance_eval(&block) if block
|
34
32
|
end
|
33
|
+
attributes
|
35
34
|
end
|
36
35
|
|
37
36
|
end
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
# _____ _
|
43
|
-
# |_ _|__ ___| |_
|
44
|
-
# | |/ _ \/ __| __|
|
45
|
-
# | | __/\__ \ |_
|
46
|
-
# |_|\___||___/\__|
|
47
|
-
#
|
48
|
-
=begin test
|
49
|
-
|
50
|
-
require 'test/unit'
|
51
|
-
|
52
|
-
class TCModule < Test::Unit::TestCase
|
53
|
-
|
54
|
-
def test_initializer
|
55
|
-
cc = Class.new
|
56
|
-
cc.class_eval {
|
57
|
-
initializer :ai
|
58
|
-
attr_reader :ai
|
59
|
-
}
|
60
|
-
c = cc.new(10)
|
61
|
-
assert_equal( 10, c.ai )
|
62
|
-
end
|
63
|
-
|
64
|
-
end
|
65
|
-
|
66
|
-
=end
|
data/lib/core/facets/hash/op.rb
CHANGED
@@ -13,19 +13,39 @@
|
|
13
13
|
module Kernel
|
14
14
|
module_function
|
15
15
|
|
16
|
-
#
|
17
|
-
# to
|
16
|
+
# Alternate to standard #p method that outputs
|
17
|
+
# Kernel#inspect to stdout, but also passes through
|
18
|
+
# the orginal argument(s).
|
18
19
|
#
|
19
|
-
#
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
# x = 1
|
21
|
+
# r = 4 + q(1)
|
22
|
+
# p r
|
23
|
+
#
|
24
|
+
# produces
|
25
|
+
#
|
26
|
+
# 1
|
27
|
+
# 5
|
28
|
+
#
|
29
|
+
# DEPRECATE AS OF 1.9, _if_ #p will then do this too.
|
30
|
+
|
31
|
+
def p(*x)
|
32
|
+
x.each{ |e| puts e.inspect } #p(*x)
|
33
|
+
x.size > 1 ? x : x.last #x.last
|
23
34
|
end
|
24
35
|
|
25
36
|
# Like #p but gives file and line number.
|
37
|
+
#
|
38
|
+
# d("hi")
|
39
|
+
#
|
40
|
+
# produces
|
41
|
+
#
|
42
|
+
# /home/dave/projects/foo.rb, 38
|
43
|
+
# "hi"
|
26
44
|
|
27
|
-
def d(x)
|
28
|
-
puts "#{__FILE__}, #{__LINE__}
|
45
|
+
def d(*x)
|
46
|
+
puts "#{__FILE__}, #{__LINE__}"
|
47
|
+
x.each{ |e| puts e.inspect } #p(*x)
|
48
|
+
x.size > 1 ? x : x.last #x.last
|
29
49
|
end
|
30
50
|
|
31
51
|
# Pretty prints an exception/error object,
|
File without changes
|
data/meta/icli.yaml
CHANGED
data/meta/manifest.txt
CHANGED
@@ -1,34 +1,26 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
cc.class_eval {
|
24
|
-
initializer :ai
|
25
|
-
attr_reader :ai
|
26
|
-
}
|
27
|
-
c = cc.new(10)
|
28
|
-
assert_equal( 10, c.ai )
|
29
|
-
end
|
30
|
-
|
1
|
+
# _____ _
|
2
|
+
# |_ _|__ ___| |_
|
3
|
+
# | |/ _ \/ __| __|
|
4
|
+
# | | __/\__ \ |
|
5
|
+
# |_|\___||___/\__|
|
6
|
+
#
|
7
|
+
# facets/class/initializer.rb
|
8
|
+
|
9
|
+
require 'facets/class/initializer.rb'
|
10
|
+
|
11
|
+
require 'test/unit'
|
12
|
+
|
13
|
+
class TC_Class_Initializer < Test::Unit::TestCase
|
14
|
+
|
15
|
+
def test_initializer
|
16
|
+
cc = Class.new
|
17
|
+
cc.class_eval {
|
18
|
+
initializer :ai
|
19
|
+
attr_reader :ai
|
20
|
+
}
|
21
|
+
c = cc.new(10)
|
22
|
+
assert_equal( 10, c.ai )
|
31
23
|
end
|
32
24
|
|
33
|
-
|
25
|
+
end
|
34
26
|
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
|
|
3
3
|
specification_version: 1
|
4
4
|
name: facets
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 2.0.
|
7
|
-
date: 2007-11-
|
6
|
+
version: 2.0.5
|
7
|
+
date: 2007-11-05 00:00:00 -05:00
|
8
8
|
summary: Premium Core Extensions and Standard Additions
|
9
9
|
require_paths:
|
10
10
|
- lib/methods
|
@@ -51,10 +51,8 @@ files:
|
|
51
51
|
- lib
|
52
52
|
- lib/core
|
53
53
|
- lib/core/facets
|
54
|
-
- lib/core/facets.rb
|
55
54
|
- lib/core/facets/1stclassmethod.rb
|
56
55
|
- lib/core/facets/array
|
57
|
-
- lib/core/facets/array.rb
|
58
56
|
- lib/core/facets/array/conjoin.rb
|
59
57
|
- lib/core/facets/array/delete.rb
|
60
58
|
- lib/core/facets/array/indexable.rb
|
@@ -66,30 +64,30 @@ files:
|
|
66
64
|
- lib/core/facets/array/splice.rb
|
67
65
|
- lib/core/facets/array/stackable.rb
|
68
66
|
- lib/core/facets/array/unzip.rb
|
67
|
+
- lib/core/facets/array.rb
|
69
68
|
- lib/core/facets/binding
|
70
|
-
- lib/core/facets/binding.rb
|
71
69
|
- lib/core/facets/binding/cflow.rb
|
72
70
|
- lib/core/facets/binding/eval.rb
|
73
71
|
- lib/core/facets/binding/vars.rb
|
72
|
+
- lib/core/facets/binding.rb
|
74
73
|
- lib/core/facets/boolean.rb
|
75
74
|
- lib/core/facets/class
|
76
|
-
- lib/core/facets/class.rb
|
77
75
|
- lib/core/facets/class/descendents.rb
|
78
76
|
- lib/core/facets/class/initializer.rb
|
77
|
+
- lib/core/facets/class.rb
|
79
78
|
- lib/core/facets/comparable
|
80
|
-
- lib/core/facets/comparable.rb
|
81
79
|
- lib/core/facets/comparable/bound.rb
|
82
80
|
- lib/core/facets/comparable/cmp.rb
|
81
|
+
- lib/core/facets/comparable.rb
|
83
82
|
- lib/core/facets/continuation
|
84
|
-
- lib/core/facets/continuation.rb
|
85
83
|
- lib/core/facets/continuation/create.rb
|
84
|
+
- lib/core/facets/continuation.rb
|
86
85
|
- lib/core/facets/conversion.rb
|
87
86
|
- lib/core/facets/dir
|
88
|
-
- lib/core/facets/dir.rb
|
89
87
|
- lib/core/facets/dir/multiglob.rb
|
90
88
|
- lib/core/facets/dir/traverse.rb
|
89
|
+
- lib/core/facets/dir.rb
|
91
90
|
- lib/core/facets/enumerable
|
92
|
-
- lib/core/facets/enumerable.rb
|
93
91
|
- lib/core/facets/enumerable/cartesian.rb
|
94
92
|
- lib/core/facets/enumerable/collate.rb
|
95
93
|
- lib/core/facets/enumerable/collect.rb
|
@@ -97,21 +95,21 @@ files:
|
|
97
95
|
- lib/core/facets/enumerable/count.rb
|
98
96
|
- lib/core/facets/enumerable/permutation.rb
|
99
97
|
- lib/core/facets/enumerable/probability.rb
|
98
|
+
- lib/core/facets/enumerable.rb
|
100
99
|
- lib/core/facets/facets.rb
|
101
100
|
- lib/core/facets/file
|
102
|
-
- lib/core/facets/file.rb
|
103
101
|
- lib/core/facets/file/read.rb
|
104
102
|
- lib/core/facets/file/topath.rb
|
105
103
|
- lib/core/facets/file/write.rb
|
104
|
+
- lib/core/facets/file.rb
|
106
105
|
- lib/core/facets/filetest
|
107
|
-
- lib/core/facets/filetest.rb
|
108
106
|
- lib/core/facets/filetest/root.rb
|
107
|
+
- lib/core/facets/filetest.rb
|
109
108
|
- lib/core/facets/float
|
110
|
-
- lib/core/facets/float.rb
|
111
109
|
- lib/core/facets/float/round.rb
|
110
|
+
- lib/core/facets/float.rb
|
112
111
|
- lib/core/facets/functor.rb
|
113
112
|
- lib/core/facets/hash
|
114
|
-
- lib/core/facets/hash.rb
|
115
113
|
- lib/core/facets/hash/at.rb
|
116
114
|
- lib/core/facets/hash/delete.rb
|
117
115
|
- lib/core/facets/hash/has_keys.rb
|
@@ -127,15 +125,15 @@ files:
|
|
127
125
|
- lib/core/facets/hash/traverse.rb
|
128
126
|
- lib/core/facets/hash/update.rb
|
129
127
|
- lib/core/facets/hash/weave.rb
|
128
|
+
- lib/core/facets/hash.rb
|
130
129
|
- lib/core/facets/indexable.rb
|
131
130
|
- lib/core/facets/integer
|
132
|
-
- lib/core/facets/integer.rb
|
133
131
|
- lib/core/facets/integer/bitmask.rb
|
134
132
|
- lib/core/facets/integer/factorial.rb
|
135
133
|
- lib/core/facets/integer/multiples.rb
|
136
134
|
- lib/core/facets/integer/of.rb
|
135
|
+
- lib/core/facets/integer.rb
|
137
136
|
- lib/core/facets/kernel
|
138
|
-
- lib/core/facets/kernel.rb
|
139
137
|
- lib/core/facets/kernel/ask.rb
|
140
138
|
- lib/core/facets/kernel/callstack.rb
|
141
139
|
- lib/core/facets/kernel/constant.rb
|
@@ -155,11 +153,11 @@ files:
|
|
155
153
|
- lib/core/facets/kernel/tap.rb
|
156
154
|
- lib/core/facets/kernel/val.rb
|
157
155
|
- lib/core/facets/kernel/withattr.rb
|
156
|
+
- lib/core/facets/kernel.rb
|
158
157
|
- lib/core/facets/matchdata
|
159
|
-
- lib/core/facets/matchdata.rb
|
160
158
|
- lib/core/facets/matchdata/matchset.rb
|
159
|
+
- lib/core/facets/matchdata.rb
|
161
160
|
- lib/core/facets/module
|
162
|
-
- lib/core/facets/module.rb
|
163
161
|
- lib/core/facets/module/abstract.rb
|
164
162
|
- lib/core/facets/module/alias.rb
|
165
163
|
- lib/core/facets/module/attr.rb
|
@@ -171,28 +169,28 @@ files:
|
|
171
169
|
- lib/core/facets/module/name.rb
|
172
170
|
- lib/core/facets/module/require.rb
|
173
171
|
- lib/core/facets/module/traits.rb
|
172
|
+
- lib/core/facets/module.rb
|
174
173
|
- lib/core/facets/nilclass
|
175
|
-
- lib/core/facets/nilclass.rb
|
176
174
|
- lib/core/facets/nilclass/ergo.rb
|
177
175
|
- lib/core/facets/nilclass/status.rb
|
176
|
+
- lib/core/facets/nilclass.rb
|
178
177
|
- lib/core/facets/numeric
|
179
|
-
- lib/core/facets/numeric.rb
|
180
178
|
- lib/core/facets/numeric/round.rb
|
179
|
+
- lib/core/facets/numeric.rb
|
181
180
|
- lib/core/facets/proc
|
182
|
-
- lib/core/facets/proc.rb
|
183
181
|
- lib/core/facets/proc/bind.rb
|
184
182
|
- lib/core/facets/proc/compose.rb
|
185
183
|
- lib/core/facets/proc/fn.rb
|
184
|
+
- lib/core/facets/proc.rb
|
186
185
|
- lib/core/facets/range
|
187
|
-
- lib/core/facets/range.rb
|
188
186
|
- lib/core/facets/range/combine.rb
|
189
187
|
- lib/core/facets/range/overlap.rb
|
188
|
+
- lib/core/facets/range.rb
|
190
189
|
- lib/core/facets/regexp
|
191
|
-
- lib/core/facets/regexp.rb
|
192
190
|
- lib/core/facets/regexp/arity.rb
|
191
|
+
- lib/core/facets/regexp.rb
|
193
192
|
- lib/core/facets/stackable.rb
|
194
193
|
- lib/core/facets/string
|
195
|
-
- lib/core/facets/string.rb
|
196
194
|
- lib/core/facets/string/align.rb
|
197
195
|
- lib/core/facets/string/blank.rb
|
198
196
|
- lib/core/facets/string/bracket.rb
|
@@ -211,22 +209,24 @@ files:
|
|
211
209
|
- lib/core/facets/string/splice.rb
|
212
210
|
- lib/core/facets/string/stackable.rb
|
213
211
|
- lib/core/facets/string/tabs.rb
|
212
|
+
- lib/core/facets/string.rb
|
214
213
|
- lib/core/facets/symbol
|
215
|
-
- lib/core/facets/symbol.rb
|
216
214
|
- lib/core/facets/symbol/chomp.rb
|
217
215
|
- lib/core/facets/symbol/generate.rb
|
218
216
|
- lib/core/facets/symbol/not.rb
|
219
217
|
- lib/core/facets/symbol/shadow.rb
|
220
218
|
- lib/core/facets/symbol/succ.rb
|
221
219
|
- lib/core/facets/symbol/to_proc.rb
|
220
|
+
- lib/core/facets/symbol.rb
|
222
221
|
- lib/core/facets/time
|
223
|
-
- lib/core/facets/time.rb
|
224
222
|
- lib/core/facets/time/change.rb
|
225
223
|
- lib/core/facets/time/elapse.rb
|
224
|
+
- lib/core/facets/time.rb
|
226
225
|
- lib/core/facets/unboundmethod
|
227
|
-
- lib/core/facets/unboundmethod.rb
|
228
226
|
- lib/core/facets/unboundmethod/arguments.rb
|
229
227
|
- lib/core/facets/unboundmethod/name.rb
|
228
|
+
- lib/core/facets/unboundmethod.rb
|
229
|
+
- lib/core/facets.rb
|
230
230
|
- lib/methods
|
231
231
|
- lib/methods/facets
|
232
232
|
- lib/methods/facets/array
|
@@ -759,7 +759,7 @@ files:
|
|
759
759
|
- lib/more/facets/yaml.rb
|
760
760
|
- lib/more/facets/ziputils.rb
|
761
761
|
- meta
|
762
|
-
- meta/facets-2.0.
|
762
|
+
- meta/facets-2.0.5.roll
|
763
763
|
- meta/icli.yaml
|
764
764
|
- meta/manifest.txt
|
765
765
|
- task
|