arrayfu 0.1.3 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/arrayfu/arrayfu.rb +4 -0
- data/lib/arrayfu/version.rb +1 -1
- data/spec/examples/usage_spec.rb +33 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 77070642e53f996089807c35f91786b395dae8dd
|
4
|
+
data.tar.gz: 0eea6395524a1a2a407997c674b868e543769b81
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a95dc72dd902452bb4bcff04b93b1647f14d3449f8c9aa7e74cab772f7d7a990aeb42cadd5f7070462755e22affadf4d177cc39d20931a64f58dd9e8f82ccaeb
|
7
|
+
data.tar.gz: 8a5271922fd5bd197606a0611bf703bf3c9d517dcf764bc433d9793e2d796ed5f4c38bf77eaadcbc00e122568a51da39e6840202412a0ee16b16f9d811bca77d
|
data/lib/arrayfu/arrayfu.rb
CHANGED
data/lib/arrayfu/version.rb
CHANGED
data/spec/examples/usage_spec.rb
CHANGED
@@ -318,3 +318,36 @@ example 'Augment configuration using configuration block' do
|
|
318
318
|
items.once_more("Yo")
|
319
319
|
items.names.count.should == 2
|
320
320
|
end
|
321
|
+
|
322
|
+
example 'Augment configuration of an existing array' do
|
323
|
+
|
324
|
+
module ArrayConfiguration
|
325
|
+
extend self
|
326
|
+
|
327
|
+
def configuration_block
|
328
|
+
Proc.new do|array|
|
329
|
+
array.mutator :once_more
|
330
|
+
end
|
331
|
+
end
|
332
|
+
end
|
333
|
+
|
334
|
+
class SomeClass
|
335
|
+
include ArrayFu
|
336
|
+
|
337
|
+
array :names do
|
338
|
+
mutator :add_item
|
339
|
+
end
|
340
|
+
|
341
|
+
def initialize
|
342
|
+
super
|
343
|
+
array :names do
|
344
|
+
configure_using ArrayConfiguration.configuration_block
|
345
|
+
end
|
346
|
+
end
|
347
|
+
end
|
348
|
+
|
349
|
+
items = SomeClass.new
|
350
|
+
items.add_item("Yo")
|
351
|
+
items.once_more("Yo")
|
352
|
+
items.names.count.should == 2
|
353
|
+
end
|