classx 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +354 -0
- data/README +5 -0
- data/Rakefile +2 -2
- data/bench/attribute_get.rb +73 -0
- data/bench/attribute_set.rb +53 -19
- data/bench/define_attribute.rb +226 -0
- data/bench/initialize.rb +25 -7
- data/doc/output/coverage/index.html +74 -128
- data/doc/output/coverage/lib-classx-attribute_rb.html +291 -190
- data/doc/output/coverage/lib-classx-attributes_rb.html +167 -101
- data/doc/output/coverage/lib-classx-bracketable_rb.html +671 -0
- data/doc/output/coverage/lib-classx-class_attributes_rb.html +775 -0
- data/doc/output/coverage/lib-classx-commandable_rb.html +727 -0
- data/doc/output/coverage/{-Library-Ruby-Gems-gems-diff-lcs-1_1_2-lib-diff-lcs-block_rb.html → lib-classx-declare_rb.html} +60 -62
- data/doc/output/coverage/lib-classx-validate_rb.html +43 -41
- data/doc/output/coverage/lib-classx_rb.html +208 -78
- data/example/commandable.rb +1 -0
- data/lib/classx.rb +146 -16
- data/lib/classx/attribute.rb +244 -143
- data/lib/classx/attributes.rb +93 -27
- data/lib/classx/bracketable.rb +61 -0
- data/lib/classx/class_attributes.rb +165 -0
- data/lib/classx/commandable.rb +55 -4
- data/lib/classx/declare.rb +40 -3
- data/lib/classx/role/logger.rb +17 -13
- data/lib/classx/validate.rb +26 -24
- data/spec/classx/handles_spec.rb +21 -6
- data/spec/classx/serialize_spec.rb +57 -0
- data/spec/classx/{with_coerce.rb → with_coerce_spec.rb} +0 -0
- data/spec/classx/with_extend_spec.rb +58 -0
- data/spec/classx/with_include_spec.rb +58 -0
- data/spec/classx/with_validate_spec.rb +363 -0
- data/spec/classx/without_anyoption_spec.rb +1 -1
- data/spec/classx/writable_option_spec.rb +29 -4
- data/spec/classx_bracketable_spec.rb +160 -0
- data/spec/classx_class_attributes/default_option_spec.rb +121 -0
- data/spec/classx_class_attributes/dsl_accessor_spec.rb +88 -0
- data/spec/classx_class_attributes/handles_spec.rb +77 -0
- data/spec/classx_class_attributes/with_coerce_spec.rb +119 -0
- data/spec/classx_class_attributes/with_extend_spec.rb +64 -0
- data/spec/classx_class_attributes/with_include_spec.rb +64 -0
- data/spec/classx_class_attributes/with_multiple_class_spec.rb +60 -0
- data/spec/classx_class_attributes/with_validate_spec.rb +248 -0
- data/spec/classx_class_attributes/without_accessor_spec.rb +19 -0
- data/spec/classx_class_attributes/without_anyoption_spec.rb +21 -0
- data/spec/classx_class_attributes/writable_option_spec.rb +100 -0
- data/spec/classx_declare_spec.rb +117 -0
- data/spec/classx_validate_spec.rb +1 -3
- data/tasks/basic_tasks.rake +1 -1
- metadata +36 -26
- data/doc/output/coverage/-Library-Ruby-Gems-gems-diff-lcs-1_1_2-lib-diff-lcs-callbacks_rb.html +0 -932
- data/doc/output/coverage/-Library-Ruby-Gems-gems-diff-lcs-1_1_2-lib-diff-lcs-change_rb.html +0 -779
- data/doc/output/coverage/-Library-Ruby-Gems-gems-diff-lcs-1_1_2-lib-diff-lcs-hunk_rb.html +0 -867
- data/doc/output/coverage/-Library-Ruby-Gems-gems-diff-lcs-1_1_2-lib-diff-lcs_rb.html +0 -1715
- data/doc/output/coverage/-Library-Ruby-Gems-gems-rcov-0_8_1_2_0-lib-rcov_rb.html +0 -1598
- data/spec/classx/with_extend.rb +0 -27
- data/spec/classx/with_include.rb +0 -27
data/ChangeLog
CHANGED
@@ -1,3 +1,357 @@
|
|
1
|
+
commit c27d76a9e41d7f1d6f02160c6c0b555c6cd68206
|
2
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
3
|
+
Date: Sat Sep 13 00:28:06 2008 +0900
|
4
|
+
|
5
|
+
adding doc for methods.
|
6
|
+
|
7
|
+
commit 55c86d08d2a6a6acfd19a0d986a38e7b90e268b3
|
8
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
9
|
+
Date: Fri Sep 12 23:46:38 2008 +0900
|
10
|
+
|
11
|
+
update benchmark script.
|
12
|
+
|
13
|
+
commit 92ed088b66fdbf04c3c9bff6439b6f98dbf66a03
|
14
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
15
|
+
Date: Fri Sep 12 23:36:17 2008 +0900
|
16
|
+
|
17
|
+
fixed warnings.
|
18
|
+
|
19
|
+
commit 212fd510001ffac66d8c318bc8aee645566cc81f
|
20
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
21
|
+
Date: Fri Sep 12 09:23:48 2008 +0900
|
22
|
+
|
23
|
+
added rdoc.
|
24
|
+
|
25
|
+
commit 29129de8ad1f740df7a812547b734c530e4bd26e
|
26
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
27
|
+
Date: Fri Sep 12 08:36:48 2008 +0900
|
28
|
+
|
29
|
+
fixed fail test in Ruby 1.9.0
|
30
|
+
|
31
|
+
commit 058d0588e6626403bcaef9464ef40c50d52b516d
|
32
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
33
|
+
Date: Fri Sep 12 08:28:43 2008 +0900
|
34
|
+
|
35
|
+
added test for #dup
|
36
|
+
|
37
|
+
commit 1d591c1b8f78e3892b7fb010b62063da142dae16
|
38
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
39
|
+
Date: Fri Sep 12 08:25:32 2008 +0900
|
40
|
+
|
41
|
+
change to use ClassX::Bracketable in ClassX::Validate class
|
42
|
+
|
43
|
+
commit 57e61cf163f351e05bf6cdedcc519e2aa32cdc67
|
44
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
45
|
+
Date: Fri Sep 12 08:24:21 2008 +0900
|
46
|
+
|
47
|
+
added spec to ClassX::Declare and fixed bug about autoload ClassX::Bracketable
|
48
|
+
|
49
|
+
commit 0e3b72eb7d63a4bf84f121ce3a08b8d535b16d91
|
50
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
51
|
+
Date: Fri Sep 12 02:47:11 2008 +0900
|
52
|
+
|
53
|
+
fixed bug of test in Ruby 1.9.0
|
54
|
+
|
55
|
+
commit 72d4a1e60a6bbcf53d976508724c4d4948d1c744
|
56
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
57
|
+
Date: Fri Sep 12 02:36:06 2008 +0900
|
58
|
+
|
59
|
+
added test.
|
60
|
+
|
61
|
+
commit d8285a1c6f86ecb1de78f0ba61557591aca38e34
|
62
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
63
|
+
Date: Fri Sep 12 02:33:22 2008 +0900
|
64
|
+
|
65
|
+
file name is wrong in convention.
|
66
|
+
|
67
|
+
commit 0c97f016b63fb7853fcc058709ff631be13e2e5e
|
68
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
69
|
+
Date: Fri Sep 12 02:27:43 2008 +0900
|
70
|
+
|
71
|
+
It may be caching is wrong.
|
72
|
+
|
73
|
+
commit 6306fc00771d955deede79c20e68b5d2706738e8
|
74
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
75
|
+
Date: Fri Sep 12 02:19:25 2008 +0900
|
76
|
+
|
77
|
+
not commited.
|
78
|
+
|
79
|
+
commit 1883e78a6b032740350c87a5d083b959b61d04c1
|
80
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
81
|
+
Date: Fri Sep 12 01:52:15 2008 +0900
|
82
|
+
|
83
|
+
added test for ClassX::Brancketable
|
84
|
+
|
85
|
+
commit 72d8a64cc065b191a8399db1fa05abbed7b8e955
|
86
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
87
|
+
Date: Fri Sep 12 01:51:45 2008 +0900
|
88
|
+
|
89
|
+
no need to include ClassX::Validate
|
90
|
+
|
91
|
+
commit 9b437319d3a681d413dc511876e6d4146daf964f
|
92
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
93
|
+
Date: Wed Sep 10 09:11:18 2008 +0900
|
94
|
+
|
95
|
+
added ClassX::Blanketable
|
96
|
+
|
97
|
+
commit b899ce53177852463ad184f166ad8e6ce6359f8d
|
98
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
99
|
+
Date: Wed Sep 10 07:55:07 2008 +0900
|
100
|
+
|
101
|
+
added doc. make alias CAttrs as ClassX::ClassAttributes, Attrs as ClassX::Attributes
|
102
|
+
|
103
|
+
commit e08c704466dd4af37e8ab2b92ba984d03af42db6
|
104
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
105
|
+
Date: Wed Sep 10 01:20:08 2008 +0900
|
106
|
+
|
107
|
+
remove garbage.
|
108
|
+
|
109
|
+
commit cbcd811ff3fb88212f4dad175064bb1d05692275
|
110
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
111
|
+
Date: Wed Sep 10 00:20:57 2008 +0900
|
112
|
+
|
113
|
+
added comment.
|
114
|
+
|
115
|
+
commit 55775bed9ee0e686da52b2c649f7c40a6b5758f5
|
116
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
117
|
+
Date: Wed Sep 10 00:08:35 2008 +0900
|
118
|
+
|
119
|
+
added dsl_accessor compatible tests.
|
120
|
+
|
121
|
+
commit 691562a088b1a7b7ab2ff659a214aa9656212df6
|
122
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
123
|
+
Date: Tue Sep 9 08:09:30 2008 +0900
|
124
|
+
|
125
|
+
ruby1.9 return each items in instance_variables with Symbol.
|
126
|
+
|
127
|
+
commit 72a128ae5b80636799c3466a303c3caba3e2f919
|
128
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
129
|
+
Date: Tue Sep 9 02:03:07 2008 +0900
|
130
|
+
|
131
|
+
fixed spec docs.
|
132
|
+
|
133
|
+
commit e6f03314479f1692e9a04739c2395006ad9cf871
|
134
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
135
|
+
Date: Tue Sep 9 01:50:15 2008 +0900
|
136
|
+
|
137
|
+
added test about inheritance.
|
138
|
+
|
139
|
+
commit 6cfd2852d3dd4d461ab06ae983585558d576b360
|
140
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
141
|
+
Date: Tue Sep 9 01:06:14 2008 +0900
|
142
|
+
|
143
|
+
ClassX::ClassAttributes should be extend. So self.include is not need.
|
144
|
+
|
145
|
+
commit 580936730fffd5ded27ae0b47a9937ada48174e1
|
146
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
147
|
+
Date: Tue Sep 9 01:03:01 2008 +0900
|
148
|
+
|
149
|
+
added class attribute feature. you can define class attributes with a same interface of attribute.
|
150
|
+
|
151
|
+
commit 413edbea25cbc3991dd546fb0af21e82008853b7
|
152
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
153
|
+
Date: Mon Sep 8 22:35:37 2008 +0900
|
154
|
+
|
155
|
+
Serialization should support restoring instance_variables except for classx's attribute_class caching.
|
156
|
+
|
157
|
+
commit 967bb8ef27de37ea951ff2199a1d1df8d7ba3cae
|
158
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
159
|
+
Date: Mon Sep 8 08:34:58 2008 +0900
|
160
|
+
|
161
|
+
oops.
|
162
|
+
|
163
|
+
commit 3713b743286bc3076f6ef5a190dba31aebfef3a4
|
164
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
165
|
+
Date: Mon Sep 8 08:33:02 2008 +0900
|
166
|
+
|
167
|
+
added serialization support using Marshl, YAML.
|
168
|
+
|
169
|
+
commit 07a290cd3f9befefbd2987c78f889a67b81f89c8
|
170
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
171
|
+
Date: Sun Sep 7 19:24:20 2008 +0900
|
172
|
+
|
173
|
+
Become caching value when you use getter method.
|
174
|
+
|
175
|
+
commit 3e97a758c8f421b5089d44abe399ab328174afbb
|
176
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
177
|
+
Date: Sun Sep 7 18:35:08 2008 +0900
|
178
|
+
|
179
|
+
fixed revision.
|
180
|
+
|
181
|
+
commit dd1bb608dd23ebf8e569c62784778aca56917044
|
182
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
183
|
+
Date: Sun Sep 7 18:34:03 2008 +0900
|
184
|
+
|
185
|
+
refactoring code. not using attribute_of as possible.
|
186
|
+
|
187
|
+
commit 8e6541a01a49a032f59c9f6b238e0f5ccb37ddbc
|
188
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
189
|
+
Date: Sun Sep 7 18:12:54 2008 +0900
|
190
|
+
|
191
|
+
attr_get became slower a little than before.
|
192
|
+
|
193
|
+
commit 83519953e9f7140ccd10324670d37cfec3cceb16
|
194
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
195
|
+
Date: Sun Sep 7 18:06:23 2008 +0900
|
196
|
+
|
197
|
+
Allow another setter style. you can use #attr_name(val) alternate #attr_name= val
|
198
|
+
|
199
|
+
commit dd1555988fe38e3fc53e780e7b0922e8802feca1
|
200
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
201
|
+
Date: Fri Aug 29 09:09:33 2008 +0900
|
202
|
+
|
203
|
+
ruby19 can use =~ between Symbol and Regexp.
|
204
|
+
|
205
|
+
commit a48eb7c03bcee64d285eda4bd24a537f5cede81f
|
206
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
207
|
+
Date: Fri Aug 29 09:05:11 2008 +0900
|
208
|
+
|
209
|
+
support mspec because it's easy to run test as ruby 1.9. (rspec is not worked in ruby 1.9 !! )
|
210
|
+
|
211
|
+
commit 2340039002a3ff315fad5028bf2c7931ac1d1c91
|
212
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
213
|
+
Date: Thu Aug 28 00:40:51 2008 +0900
|
214
|
+
|
215
|
+
no define_method if it doesn't need.
|
216
|
+
|
217
|
+
commit 29a8e3293d07ca8dd0b4a3305d615b2968b13c55
|
218
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
219
|
+
Date: Wed Aug 27 08:28:56 2008 +0900
|
220
|
+
|
221
|
+
added :validate_each option. It's useful to validate complex structure ( for example nested Array ).
|
222
|
+
|
223
|
+
commit 36fd5a4e2320b0a68c38640ab86a1bc5cda0da2d
|
224
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
225
|
+
Date: Tue Aug 26 08:24:26 2008 +0900
|
226
|
+
|
227
|
+
don't measure GC time.
|
228
|
+
|
229
|
+
commit 1f4c448bcbc74d744be2a6e3805b461b798a7f91
|
230
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
231
|
+
Date: Mon Aug 25 09:34:28 2008 +0900
|
232
|
+
|
233
|
+
added benchmark for taking time of defining attributes.
|
234
|
+
|
235
|
+
commit 066787b4d379bdf1a83700b5fe5e629e6a423d74
|
236
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
237
|
+
Date: Sun Aug 24 23:20:09 2008 +0900
|
238
|
+
|
239
|
+
:handle option should be able to delegate method with arguments.
|
240
|
+
|
241
|
+
commit d08d8f5cc87e1a7979dc11cc0abc914a2a4c61a3
|
242
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
243
|
+
Date: Sun Aug 24 22:39:43 2008 +0900
|
244
|
+
|
245
|
+
insert line break to too long line to read.
|
246
|
+
|
247
|
+
commit 2120fafb35ee33048130b6c23c9c009e3c47f629
|
248
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
249
|
+
Date: Sun Aug 24 21:01:59 2008 +0900
|
250
|
+
|
251
|
+
fixed.BUG: when it specify invalid attribute as option, commandable would not show help message.
|
252
|
+
|
253
|
+
commit f23eb5c82c644dc45cd83568a9270153b422f8a3
|
254
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
255
|
+
Date: Sun Aug 24 17:59:26 2008 +0900
|
256
|
+
|
257
|
+
It should use Class.const_defined?
|
258
|
+
|
259
|
+
commit dd0d8b4ab4610d39b2f81361ad0b85e87bdb6847
|
260
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
261
|
+
Date: Sun Aug 24 17:52:23 2008 +0900
|
262
|
+
|
263
|
+
When attribute's config freezed. ClassX::Commandable is not worked.
|
264
|
+
|
265
|
+
commit ada4424c9d8bd443eebc0c661040ccfdebca12e4
|
266
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
267
|
+
Date: Sun Aug 24 17:43:41 2008 +0900
|
268
|
+
|
269
|
+
change not using args[key] in define_method but using via config method.
|
270
|
+
|
271
|
+
commit d0c318b1e45cdd134ca47bf48a4aae06cfcd215c
|
272
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
273
|
+
Date: Sun Aug 24 16:53:23 2008 +0900
|
274
|
+
|
275
|
+
added tests.
|
276
|
+
|
277
|
+
commit 588d9b3643ad12cfcc7b8c85a0a71834f83de24f
|
278
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
279
|
+
Date: Sun Aug 24 16:34:38 2008 +0900
|
280
|
+
|
281
|
+
test file name should be /_spec.rb$/.
|
282
|
+
|
283
|
+
commit 9a5c6802a1de610c6f93b614cbca56e10721965d
|
284
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
285
|
+
Date: Sun Aug 24 15:57:33 2008 +0900
|
286
|
+
|
287
|
+
/Libraray should not use as rcov coverage.
|
288
|
+
|
289
|
+
commit d37368e32770e14a6242bf7eb5e8390a8577e4e0
|
290
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
291
|
+
Date: Sun Aug 24 12:20:07 2008 +0900
|
292
|
+
|
293
|
+
supported defining nested name space.
|
294
|
+
|
295
|
+
commit 32ed48c6ae8a470acb3a12151102174fedccfc58
|
296
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
297
|
+
Date: Sat Aug 23 23:25:31 2008 +0900
|
298
|
+
|
299
|
+
classx/util is not merged.
|
300
|
+
|
301
|
+
commit 8e81180a717458b53fa09ec6ac4f9852f7175e8b
|
302
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
303
|
+
Date: Sat Aug 23 22:35:59 2008 +0900
|
304
|
+
|
305
|
+
added benchmark for attribute_get.
|
306
|
+
|
307
|
+
commit 115d1bcfb9cb3964c14da851259dc5bb2a6f2784
|
308
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
309
|
+
Date: Sat Aug 23 22:29:07 2008 +0900
|
310
|
+
|
311
|
+
change to cache ClassX#attribute_of. And fixed warnings.
|
312
|
+
|
313
|
+
commit a23be1ac7760fea83e4b80fdc6f06fb2839b8883
|
314
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
315
|
+
Date: Sat Aug 23 21:35:05 2008 +0900
|
316
|
+
|
317
|
+
It may be better to show attibute's parent at inspect for debugging.
|
318
|
+
|
319
|
+
commit 3593145aeb05ebba55719405232b40af903e0882
|
320
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
321
|
+
Date: Sat Aug 23 21:26:04 2008 +0900
|
322
|
+
|
323
|
+
tweaked define order.
|
324
|
+
|
325
|
+
commit daf1861b1507ea6ad87fc2be109461fd070a6b6b
|
326
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
327
|
+
Date: Sat Aug 23 20:52:11 2008 +0900
|
328
|
+
|
329
|
+
added ClassX::Validate.validate. It's good to write explicity code.
|
330
|
+
|
331
|
+
commit 508f568535cdac3319cd80b812de1fb4175c17cf
|
332
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
333
|
+
Date: Sat Aug 23 19:00:48 2008 +0900
|
334
|
+
|
335
|
+
fixed doc.
|
336
|
+
|
337
|
+
commit 6fc2c5dbbc4ed8cbd6ef62f9aaad0e3ffc7be498
|
338
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
339
|
+
Date: Sat Aug 23 15:19:20 2008 +0900
|
340
|
+
|
341
|
+
it's faster than calling from attribute_of
|
342
|
+
|
343
|
+
commit 458848fded3eeb55a7fc9048bada7c825dfb73ad
|
344
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
345
|
+
Date: Sat Aug 23 14:53:37 2008 +0900
|
346
|
+
|
347
|
+
added bench dir to gem.
|
348
|
+
|
349
|
+
commit 52afdcbfbc105d93defbf6513bc89a6827f0f386
|
350
|
+
Author: Keiji, Yoshimi <walf443@gmail.com>
|
351
|
+
Date: Sat Aug 23 14:27:39 2008 +0900
|
352
|
+
|
353
|
+
release 0.0.3
|
354
|
+
|
1
355
|
commit 106a6048c9dd61009a54bd35081e849461785560
|
2
356
|
Author: Keiji, Yoshimi <walf443@gmail.com>
|
3
357
|
Date: Sat Aug 23 14:22:09 2008 +0900
|
data/README
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
|
2
2
|
= classx
|
3
|
+
Meta Framework extending and flexible attribute like Moose ( perl )
|
3
4
|
|
4
5
|
== Synopsis
|
5
6
|
|
@@ -34,6 +35,10 @@ perl's Moose like Class interface.
|
|
34
35
|
|
35
36
|
== Features/Problems
|
36
37
|
|
38
|
+
== SEE ALSO
|
39
|
+
|
40
|
+
Moose: http://search.cpan.org/~drolsky/Moose-0.57/lib/Moose.pm
|
41
|
+
|
37
42
|
== Copyright
|
38
43
|
|
39
44
|
Author:: Keiji, Yoshimi <walf443 at gmail.com>
|
data/Rakefile
CHANGED
@@ -14,10 +14,10 @@ load File.join(File.dirname(__FILE__), 'tasks', 'basic_config.rake')
|
|
14
14
|
|
15
15
|
NAME = "classx"
|
16
16
|
DESCRIPTION = <<-"END_DESCRIPTION"
|
17
|
-
|
17
|
+
Meta Framework extending and flexible attribute like Moose ( perl )
|
18
18
|
END_DESCRIPTION
|
19
19
|
BIN_FILES = %w( )
|
20
|
-
VERS = "0.0.
|
20
|
+
VERS = "0.0.4"
|
21
21
|
|
22
22
|
EXTRA_RDOC_FILES = []
|
23
23
|
HECKLE_ROOT_MODULES = ["Classx"]
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require 'benchmark'
|
2
|
+
$LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib' )))
|
3
|
+
require 'classx'
|
4
|
+
|
5
|
+
class PointWithClassX
|
6
|
+
include ClassX
|
7
|
+
has :x
|
8
|
+
has :y
|
9
|
+
has :z
|
10
|
+
end
|
11
|
+
|
12
|
+
class PointWithoutClassX
|
13
|
+
attr_reader :x, :y, :z
|
14
|
+
|
15
|
+
def initialize hash
|
16
|
+
@x = hash[:x]
|
17
|
+
@y = hash[:y]
|
18
|
+
@z = hash[:z]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
COUNT = 1000
|
23
|
+
|
24
|
+
point_with_classx = PointWithClassX.new({ :x => 0, :y => 0, :z => 0 })
|
25
|
+
point_without_classx = PointWithoutClassX.new({ :x => 0, :y => 0, :z => 0 })
|
26
|
+
|
27
|
+
def do_bench klass
|
28
|
+
GC.disable
|
29
|
+
COUNT.times do
|
30
|
+
klass.__send__ :x
|
31
|
+
klass.__send__ :y
|
32
|
+
klass.__send__ :z
|
33
|
+
end
|
34
|
+
GC.enable
|
35
|
+
end
|
36
|
+
|
37
|
+
Benchmark.bm do |x|
|
38
|
+
x.report 'classx' do
|
39
|
+
do_bench point_with_classx
|
40
|
+
end
|
41
|
+
x.report 'normal class' do
|
42
|
+
do_bench point_without_classx
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# On my environment( MacBook1.1 Intel Core Duo 1.83 GHz, 2GB), result is like that. TOOOOO SLOOOW classX!!!!.
|
47
|
+
#
|
48
|
+
# ----------------------------------------------------------
|
49
|
+
# result after 92ed088b6 ( before 0.0.4 )
|
50
|
+
# user system total real
|
51
|
+
# classx 0.000000 0.000000 0.000000 ( 0.007358)
|
52
|
+
# normal class 0.010000 0.000000 0.010000 ( 0.001116)
|
53
|
+
# ----------------------------------------------------------
|
54
|
+
# result after 3e97a758
|
55
|
+
# user system total real
|
56
|
+
# classx 0.010000 0.000000 0.010000 ( 0.007955)
|
57
|
+
# normal class 0.000000 0.000000 0.000000 ( 0.001105)
|
58
|
+
# ----------------------------------------------------------
|
59
|
+
# result after 83519953e
|
60
|
+
# user system total real
|
61
|
+
# classx 0.010000 0.000000 0.010000 ( 0.016879)
|
62
|
+
# normal class 0.000000 0.000000 0.000000 ( 0.001112)
|
63
|
+
# ----------------------------------------------------------
|
64
|
+
# result after 1f4c448b
|
65
|
+
# user system total real
|
66
|
+
# classx 0.010000 0.000000 0.010000 ( 0.013445)
|
67
|
+
# normal class 0.000000 0.000000 0.000000 ( 0.001004)
|
68
|
+
# ----------------------------------------------------------
|
69
|
+
# result after 283903a
|
70
|
+
# user system total real
|
71
|
+
# classx 0.020000 0.000000 0.020000 ( 0.016892)
|
72
|
+
# normal class 0.000000 0.000000 0.000000 ( 0.000729)
|
73
|
+
# ----------------------------------------------------------
|