tbpgr_utils 0.0.23 → 0.0.24
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/README.md +41 -2
- data/lib/open_classes/array.rb +349 -312
- data/lib/tbpgr_utils/version.rb +1 -1
- data/spec/open_classes/array_spec.rb +752 -678
- metadata +12 -12
data/README.md
CHANGED
@@ -26,6 +26,7 @@ Or install it yourself as:
|
|
26
26
|
|[TbpgrUtils Array#together_compact](#arraytogether_compact) |together version of Array#compact. together_compact has alias :tcompact. this is immutable. |
|
27
27
|
|[TbpgrUtils Array#together_compact!](#arraytogether_compact-1) |together version of Array#compact!. together_compact! has alias :tcompact! this is mutable. |
|
28
28
|
|[TbpgrUtils Array#together_concat](#arraytogether_concat) |together version of Array#concat. together_concat has alias :tconcat |
|
29
|
+
|[TbpgrUtils Array#together_delete](#arraytogether_delete) |together version of Array#delete. together_delete has alias :tdelete |
|
29
30
|
|[TbpgrUtils Array#together_map](#arraytogether_mapor-tmap-together_collect-tcollect) |together version of Enumerable#map. together_map has aliases [:tmap, :together_collect, :tcollect] |
|
30
31
|
|[TbpgrUtils Array#together_map!](#arraytogether_map-1or-tmap-1-together_collect-1-tcollect-1) |together version of Enumerable#map!. together_map! has aliases [:tmap!, :together_collect!, :tcollect!] |
|
31
32
|
|[TbpgrUtils Array#together_reduce](#arraytogether_reduceor-treduce-together_inject-tinject) |together version of Enumerable#reduce. together_reduce has aliases [:treduce, :together_inject, :tinject] |
|
@@ -134,6 +135,43 @@ print numbers # => ["1", "2", "3", 4, 5, 6]
|
|
134
135
|
|
135
136
|
[back to list](#list)
|
136
137
|
|
138
|
+
### Array#together_delete
|
139
|
+
~~~ruby
|
140
|
+
require 'tbpgr_utils'
|
141
|
+
|
142
|
+
child1 = [1, 2, 3, 4]
|
143
|
+
child2 = [2, 3, 4, 5]
|
144
|
+
lists = [child1, child2]
|
145
|
+
ret = lists.together_delete 2
|
146
|
+
print lists # => output [[1, 3, 4], [3, 4, 5]]
|
147
|
+
~~~
|
148
|
+
|
149
|
+
if delete target is not exist
|
150
|
+
~~~ruby
|
151
|
+
require 'tbpgr_utils'
|
152
|
+
|
153
|
+
child1 = [1, 2, 3, 4]
|
154
|
+
child2 = [2, 3, 4, 5]
|
155
|
+
lists = [child1, child2]
|
156
|
+
ret = lists.together_delete 6
|
157
|
+
print ret # => nil
|
158
|
+
print lists # => output [[1, 2, 3, 4], [2, 3, 4, 5]]
|
159
|
+
~~~
|
160
|
+
|
161
|
+
if delete target is not exist and use block
|
162
|
+
~~~ruby
|
163
|
+
require 'tbpgr_utils'
|
164
|
+
|
165
|
+
child1 = [1, 2, 3, 4]
|
166
|
+
child2 = [2, 3, 4, 5]
|
167
|
+
lists = [child1, child2]
|
168
|
+
ret = lists.together_delete(6) { 999 }
|
169
|
+
print ret # => 999
|
170
|
+
print lists # => output [[1, 2, 3, 4], [2, 3, 4, 5]]
|
171
|
+
~~~
|
172
|
+
|
173
|
+
[back to list](#list)
|
174
|
+
|
137
175
|
### Array#together_map(or tmap, together_collect, tcollect)
|
138
176
|
~~~ruby
|
139
177
|
require 'tbpgr_utils'
|
@@ -858,13 +896,14 @@ if you are Sublime Text2 user, you can use snippet for TbpgrUtils.
|
|
858
896
|
https://github.com/tbpgr/tbpgr_utils_snippets
|
859
897
|
|
860
898
|
## History
|
899
|
+
* version 0.0.24 : add Array#together_delete(alias tdelete)
|
861
900
|
* version 0.0.23 : add Array#together_map!(aliases => [tmap!, together_collect!, tcollect!])
|
862
901
|
* version 0.0.22 : add Array#together_compact. together_compact has alias :tcompact. Array#together_compact!. together_compact! has alias :tcompact!.
|
863
902
|
* version 0.0.21 : add Array#together_clear. together_clear has alias :tclear
|
864
903
|
* version 0.0.20 : add Array#together_at. together_at has alias :tat
|
865
904
|
* version 0.0.19 : add AttributesHashable module.
|
866
|
-
* version 0.0.18 : add Array#together_concat. together_concat has alias
|
867
|
-
* version 0.0.17 : add Array#together_reduce(or
|
905
|
+
* version 0.0.18 : add Array#together_concat. together_concat has alias tconcat
|
906
|
+
* version 0.0.17 : add Array#together_reduce(or treduce, together_inject, tinject)
|
868
907
|
* version 0.0.16 : add Array#together_select(or tselect, together_find_all, tfindall)
|
869
908
|
* version 0.0.15 : add Module.alias_methods
|
870
909
|
* version 0.0.14 : add Array#together_map(aliases => [tmap, together_collect, tcollect])
|