arrayfu 0.1.3 → 0.2.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d99b471be74c0319ed98b282831aaecf0cdd2c15
4
- data.tar.gz: d5598a6bafc17245303829c2e92d683128d6e162
3
+ metadata.gz: 77070642e53f996089807c35f91786b395dae8dd
4
+ data.tar.gz: 0eea6395524a1a2a407997c674b868e543769b81
5
5
  SHA512:
6
- metadata.gz: 8902d3a763f2b3bb0136895349d1091a61287b8a3c7e38a9ef060508791d4fd191d5f910552b2298a6ec28b64a541e7b5a9321d5a07e91a95c2c2830855ff6c8
7
- data.tar.gz: f018d2f6af9e6836ce76fd2b5b00ca15d73f02cf4f86d45fc4ffe22c27549c1b5331c46e4cc5d35da3c8849d6844b22dd0afc2ae907d3ac20d1bed097b473ada
6
+ metadata.gz: a95dc72dd902452bb4bcff04b93b1647f14d3449f8c9aa7e74cab772f7d7a990aeb42cadd5f7070462755e22affadf4d177cc39d20931a64f58dd9e8f82ccaeb
7
+ data.tar.gz: 8a5271922fd5bd197606a0611bf703bf3c9d517dcf764bc433d9793e2d796ed5f4c38bf77eaadcbc00e122568a51da39e6840202412a0ee16b16f9d811bca77d
@@ -12,6 +12,10 @@ module ArrayFu
12
12
  end
13
13
  end
14
14
 
15
+ def array(name, &block)
16
+ self.class.array(name, &block)
17
+ end
18
+
15
19
  module ClassMethods
16
20
  def array_definitions
17
21
  @array_definitions ||= {}
@@ -1,3 +1,3 @@
1
1
  module ArrayFu
2
- VERSION = "0.1.3"
2
+ VERSION = "0.2.3"
3
3
  end
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arrayfu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Develop With Passion®