array-hooked 1.1.0 → 1.1.1
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/CHANGELOG.rdoc +4 -0
- data/lib/array/hooked.rb +1 -29
- data/lib/array/hooked/array_interface.rb +727 -572
- data/lib/array/namespaces.rb +0 -3
- data/lib/array/requires.rb +0 -2
- data/spec/{Array/Hooked_spec.rb → array/hooked_spec.rb} +0 -84
- metadata +19 -4
- data/lib/hooked/array.rb +0 -2
data/lib/array/namespaces.rb
CHANGED
data/lib/array/requires.rb
CHANGED
|
@@ -670,89 +670,5 @@ describe ::Array::Hooked do
|
|
|
670
670
|
hooked_array.should == [ ]
|
|
671
671
|
|
|
672
672
|
end
|
|
673
|
-
|
|
674
|
-
########################
|
|
675
|
-
# child_pre_set_hook #
|
|
676
|
-
########################
|
|
677
|
-
|
|
678
|
-
it 'has a hook that is called before setting a value that has been passed by a parent; return value is used in place of object' do
|
|
679
|
-
|
|
680
|
-
class ::Array::Hooked::SubMockChildPreSet < ::Array::Hooked
|
|
681
|
-
|
|
682
|
-
def child_pre_set_hook( index, object, is_insert = false )
|
|
683
|
-
return :some_other_value
|
|
684
|
-
end
|
|
685
|
-
|
|
686
|
-
end
|
|
687
|
-
|
|
688
|
-
hooked_array = ::Array::Hooked::SubMockChildPreSet.new
|
|
689
|
-
hooked_array.push( :some_value )
|
|
690
|
-
|
|
691
|
-
end
|
|
692
|
-
|
|
693
|
-
#########################
|
|
694
|
-
# child_post_set_hook #
|
|
695
|
-
#########################
|
|
696
|
-
|
|
697
|
-
it 'has a hook that is called after setting a value passed by a parent' do
|
|
698
|
-
|
|
699
|
-
class ::Array::Hooked::SubMockChildPostSet < ::Array::Hooked
|
|
700
|
-
|
|
701
|
-
def child_post_set_hook( index, object, is_insert = false )
|
|
702
|
-
push( :some_other_value )
|
|
703
|
-
end
|
|
704
|
-
|
|
705
|
-
end
|
|
706
|
-
|
|
707
|
-
hooked_array = ::Array::Hooked::SubMockChildPostSet.new
|
|
708
|
-
hooked_array.push( :some_value )
|
|
709
|
-
|
|
710
|
-
hooked_array.should == [ :some_value ]
|
|
711
|
-
|
|
712
|
-
end
|
|
713
|
-
|
|
714
|
-
###########################
|
|
715
|
-
# child_pre_delete_hook #
|
|
716
|
-
###########################
|
|
717
|
-
|
|
718
|
-
it 'has a hook that is called before deleting an index that has been passed by a parent; if return value is false, delete does not occur' do
|
|
719
|
-
|
|
720
|
-
class ::Array::Hooked::SubMockChildPreDelete < ::Array::Hooked
|
|
721
|
-
|
|
722
|
-
def child_pre_delete_hook( index )
|
|
723
|
-
false
|
|
724
|
-
end
|
|
725
|
-
|
|
726
|
-
end
|
|
727
|
-
|
|
728
|
-
hooked_array = ::Array::Hooked::SubMockChildPreDelete.new
|
|
729
|
-
hooked_array.push( :some_value )
|
|
730
|
-
hooked_array.delete( :some_value )
|
|
731
|
-
|
|
732
|
-
hooked_array.should == [ ]
|
|
733
|
-
|
|
734
|
-
end
|
|
735
|
-
|
|
736
|
-
############################
|
|
737
|
-
# child_post_delete_hook #
|
|
738
|
-
############################
|
|
739
|
-
|
|
740
|
-
it 'has a hook that is called after deleting an index passed by a parent' do
|
|
741
|
-
|
|
742
|
-
class ::Array::Hooked::SubMockChildPostDelete < ::Array::Hooked
|
|
743
|
-
|
|
744
|
-
def child_post_delete_hook( index, object )
|
|
745
|
-
delete( :some_other_value )
|
|
746
|
-
end
|
|
747
|
-
|
|
748
|
-
end
|
|
749
|
-
|
|
750
|
-
hooked_array = ::Array::Hooked::SubMockChildPostDelete.new
|
|
751
|
-
hooked_array.push( :some_value )
|
|
752
|
-
hooked_array.delete( :some_value )
|
|
753
|
-
|
|
754
|
-
hooked_array.should == [ ]
|
|
755
|
-
|
|
756
|
-
end
|
|
757
673
|
|
|
758
674
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: array-hooked
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.1
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2012-06
|
|
12
|
+
date: 2012-07-06 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: identifies_as
|
|
@@ -27,6 +27,22 @@ dependencies:
|
|
|
27
27
|
- - ! '>='
|
|
28
28
|
- !ruby/object:Gem::Version
|
|
29
29
|
version: '0'
|
|
30
|
+
- !ruby/object:Gem::Dependency
|
|
31
|
+
name: module-cluster
|
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
|
33
|
+
none: false
|
|
34
|
+
requirements:
|
|
35
|
+
- - ! '>='
|
|
36
|
+
- !ruby/object:Gem::Version
|
|
37
|
+
version: '0'
|
|
38
|
+
type: :runtime
|
|
39
|
+
prerelease: false
|
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
41
|
+
none: false
|
|
42
|
+
requirements:
|
|
43
|
+
- - ! '>='
|
|
44
|
+
- !ruby/object:Gem::Version
|
|
45
|
+
version: '0'
|
|
30
46
|
description: A subclass of Array that offers event hooks for pre-insert/pre-set/pre-delete,
|
|
31
47
|
insert/set/delete. ::HookedArray offers implicit reference to a configuration instance.
|
|
32
48
|
email: asher@ridiculouspower.com
|
|
@@ -39,8 +55,7 @@ files:
|
|
|
39
55
|
- lib/array/namespaces.rb
|
|
40
56
|
- lib/array/requires.rb
|
|
41
57
|
- lib/array-hooked.rb
|
|
42
|
-
-
|
|
43
|
-
- spec/Array/Hooked_spec.rb
|
|
58
|
+
- spec/array/hooked_spec.rb
|
|
44
59
|
- README.md
|
|
45
60
|
- CHANGELOG.rdoc
|
|
46
61
|
homepage: http://rubygems.org/gems/array-hooked
|
data/lib/hooked/array.rb
DELETED