tbpgr_utils 0.0.32 → 0.0.33

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml ADDED
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+ before_install:
3
+ - gem update --system 2.1.11
4
+ - gem --version
5
+ rvm:
6
+ - 1.9.3
7
+ - 2.0.0
8
+ - 2.1.0
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # TbpgrUtils
2
2
 
3
+ [![Build Status](https://travis-ci.org/tbpgr/tbpgr_utils.png?branch=master)](https://travis-ci.org/tbpgr/tbpgr_utils)
4
+
3
5
  TbpgrUtils is Utilities.
4
6
 
5
7
  ## Installation
@@ -39,6 +41,7 @@ Or install it yourself as:
39
41
  |[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!] |
40
42
  |[TbpgrUtils Array#together_reduce](#arraytogether_reduceor-treduce-together_inject-tinject) |together version of Enumerable#reduce. together_reduce has aliases [:treduce, :together_inject, :tinject] |
41
43
  |[TbpgrUtils Array#together_select](#arraytogether_selector-tselect-together_find_all-tfindall) |together version of Enumerable#select. together_select has aliases [:tselect, :together_find_all, :tfindall] |
44
+ |[TbpgrUtils Array#together_shift](#arraytogether_shift) |together version of Array#shift. together_shift has alias :tshift |
42
45
  |[TbpgrUtils Array#together_with_index](#arraytogether_with_index) |loop all arrays by block with index |
43
46
  |[AttributesHashable.to_hash](#attributeshashableto_hash) |define to_hash method for get instance_values |
44
47
  |[AttributesInitializable::ClassMethods.attr_accessor_init](#attributesinitializableclassmethodsattr_accessor_init) |generate attr_accessor + initializer |
@@ -555,6 +558,43 @@ print ret # => output [[1, 3], [4, 2]]
555
558
 
556
559
  [back to list](#list)
557
560
 
561
+ ### Array#together_shift(or tshift)
562
+ together_shift has alias :tshift
563
+
564
+ not empty case
565
+ ~~~ruby
566
+ lists = [[1, 2], [5, 6]]
567
+ ret = lists.together_shift
568
+ print ret # => [1, 5]
569
+ print lists # => [2, 6]
570
+ ~~~
571
+
572
+ empty case
573
+ ~~~ruby
574
+ lists = [[], []]
575
+ ret = lists.together_shift
576
+ print ret # => [nil, nil]
577
+ print lists # => [[], []]
578
+ ~~~
579
+
580
+ not empty case
581
+ ~~~ruby with args
582
+ lists = [[1, 2], [5, 6]]
583
+ ret = lists.together_shift 2
584
+ print ret # => [[1, 2], [5, 6]]
585
+ print lists # => [[], []]
586
+ ~~~
587
+
588
+ not empty case
589
+ ~~~ruby with args
590
+ lists = [[], []]
591
+ ret = lists.together_shift 2
592
+ print ret # => [[], []]
593
+ print lists # => [[], []]
594
+ ~~~
595
+
596
+ [back to list](#list)
597
+
558
598
  ### Array#together_with_index
559
599
  ~~~ruby
560
600
  require 'tbpgr_utils'
@@ -1175,6 +1215,7 @@ if you are Sublime Text2 user, you can use snippet for TbpgrUtils.
1175
1215
  https://github.com/tbpgr/tbpgr_utils_snippets
1176
1216
 
1177
1217
  ## History
1218
+ * version 0.0.33 : add Array#together_shift(alias tshift).
1178
1219
  * version 0.0.32 : add Array#together_insert(alias tinsert).
1179
1220
  * version 0.0.31 : add Array#together_index(alias tindex).
1180
1221
  * version 0.0.30 : add Array#together_include?(alias tinclude?).
data/Rakefile CHANGED
@@ -1 +1,8 @@
1
1
  require "bundler/gem_tasks"
2
+ require 'rspec/core'
3
+ require 'rspec/core/rake_task'
4
+ task :default => [:spec]
5
+
6
+ RSpec::Core::RakeTask.new(:spec) do |spec|
7
+ spec.pattern = 'spec/**/*_spec.rb'
8
+ end