tbpgr_utils 0.0.115 → 0.0.116

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -5,4 +5,4 @@ before_install:
5
5
  rvm:
6
6
  - 1.9.3
7
7
  - 2.0.0
8
- - 2.1.0
8
+ - 2.1
data/README.md CHANGED
@@ -24,6 +24,7 @@ Or install it yourself as:
24
24
  ### List
25
25
  | class/module/method | mean |
26
26
  |:----------- |:------------ |
27
+ |[TbpgrUtils Array#>>](#array) |alias of map(&:method_symbol) |
27
28
  |[TbpgrUtils Array#to_table](#arrayto_table) |Array(Array, Array...) to table format. |
28
29
  |[TbpgrUtils Array#to_html_table](#arrayto_html_table) |Array(Array, Array...) to html table format. |
29
30
  |[TbpgrUtils Array#together](#arraytogether) |loop all arrays by block |
@@ -157,6 +158,15 @@ Or install it yourself as:
157
158
  |[Templatable module](#templatable) |get result from template + placeholder |
158
159
  |[TemplateMethodable module](#templatemethodable) |for Template Method Pattern |
159
160
 
161
+ ### Array#>>
162
+ ~~~ruby
163
+ require 'tbpgr_utils'
164
+ [*'a'..'c']>>:ord # => [97, 98, 99]
165
+ [*'a'..'c']>>:upcase # => ["A", "B", "C"]
166
+ ~~~
167
+
168
+ [back to list](#list)
169
+
160
170
  ### Array#to_table
161
171
  ~~~ruby
162
172
  require 'tbpgr_utils'
@@ -3514,6 +3524,7 @@ if you are Sublime Text2 user, you can use snippet for TbpgrUtils.
3514
3524
  https://github.com/tbpgr/tbpgr_utils_snippets
3515
3525
 
3516
3526
  ## History
3527
+ * version 0.0.116 : add Array#>>
3517
3528
  * version 0.0.115 : add MarkdownString#codes
3518
3529
  * version 0.0.114 : add MarkdownString#code
3519
3530
  * version 0.0.113 : add MarkdownString#link
@@ -0,0 +1,15 @@
1
+ # encoding: utf-8
2
+
3
+ # Array
4
+ class Array
5
+ # alias of map(&:method_symbol)
6
+ #
7
+ # === Example
8
+ #
9
+ # [*'a'..'c']>>:ord # => [97, 98, 99]
10
+ #
11
+ def >>(method_name)
12
+ return self unless [Symbol, String].include? method_name.class
13
+ map(&method_name.to_sym)
14
+ end
15
+ end
@@ -1,4 +1,5 @@
1
1
  # encoding: utf-8
2
+ require 'open_classes/array/gte_gte'
2
3
  require 'open_classes/array/to_html_table'
3
4
  require 'open_classes/array/to_table'
4
5
  require 'open_classes/array/together'
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Tbpgr Utilities
4
4
  module TbpgrUtils
5
- VERSION = '0.0.115'
5
+ VERSION = '0.0.116'
6
6
  end
data/rubocop-todo.yml CHANGED
@@ -52,3 +52,6 @@ UselessAssignment:
52
52
 
53
53
  WordArray:
54
54
  Enabled: false
55
+
56
+ OpMethod:
57
+ Enabled: false
@@ -0,0 +1,57 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+ require 'tbpgr_utils'
4
+
5
+ describe Array do
6
+ context :>> do
7
+ cases = [
8
+ {
9
+ case_no: 1,
10
+ case_title: 'valid case',
11
+ input: [*'a'..'c'],
12
+ method_name: :ord,
13
+ expected: [97, 98, 99],
14
+ },
15
+ {
16
+ case_no: 2,
17
+ case_title: 'valid case',
18
+ input: [*'a'..'c'],
19
+ method_name: 'ord',
20
+ expected: [97, 98, 99],
21
+ },
22
+ {
23
+ case_no: 3,
24
+ case_title: 'valid case',
25
+ input: [*'a'..'c'],
26
+ method_name: 1,
27
+ expected: [*'a'..'c'],
28
+ },
29
+ ]
30
+
31
+ cases.each do |c|
32
+ it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
33
+ begin
34
+ case_before c
35
+
36
+ # -- given --
37
+ # nothing
38
+
39
+ # -- when/then --
40
+ actual = c[:input] >> c[:method_name]
41
+
42
+ expect(actual).to eq(c[:expected])
43
+ ensure
44
+ case_after c
45
+ end
46
+ end
47
+
48
+ def case_before(c)
49
+ # implement each case before
50
+ end
51
+
52
+ def case_after(c)
53
+ # implement each case after
54
+ end
55
+ end
56
+ end
57
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tbpgr_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.115
4
+ version: 0.0.116
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-05-02 00:00:00.000000000 Z
12
+ date: 2014-05-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
16
- requirement: &27318012 !ruby/object:Gem::Requirement
16
+ requirement: &21945648 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 4.0.1
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *27318012
24
+ version_requirements: *21945648
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: bundler
27
- requirement: &27316524 !ruby/object:Gem::Requirement
27
+ requirement: &21942708 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '1.3'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *27316524
35
+ version_requirements: *21942708
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rake
38
- requirement: &27315576 !ruby/object:Gem::Requirement
38
+ requirement: &21942348 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *27315576
46
+ version_requirements: *21942348
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rspec
49
- requirement: &27314844 !ruby/object:Gem::Requirement
49
+ requirement: &21941880 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 2.14.1
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *27314844
57
+ version_requirements: *21941880
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: simplecov
60
- requirement: &27313560 !ruby/object:Gem::Requirement
60
+ requirement: &21941148 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: 0.8.2
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *27313560
68
+ version_requirements: *21941148
69
69
  description: Utilities
70
70
  email:
71
71
  - tbpgr@tbpgr.jp
@@ -121,6 +121,7 @@ files:
121
121
  - lib/markdown_string.rb
122
122
  - lib/metasyntactic_variable.rb
123
123
  - lib/open_classes/array.rb
124
+ - lib/open_classes/array/gte_gte.rb
124
125
  - lib/open_classes/array/to_html_table.rb
125
126
  - lib/open_classes/array/to_table.rb
126
127
  - lib/open_classes/array/together.rb
@@ -251,6 +252,7 @@ files:
251
252
  - spec/markdown/ol_spec.rb
252
253
  - spec/markdown/ul_spec.rb
253
254
  - spec/metasyntactic_variable_spec.rb
255
+ - spec/open_classes/array/gte_gte_spec.rb
254
256
  - spec/open_classes/array/to_html_table_spec.rb
255
257
  - spec/open_classes/array/to_table_spec.rb
256
258
  - spec/open_classes/array/together_at_spec.rb
@@ -398,6 +400,7 @@ test_files:
398
400
  - spec/markdown/ol_spec.rb
399
401
  - spec/markdown/ul_spec.rb
400
402
  - spec/metasyntactic_variable_spec.rb
403
+ - spec/open_classes/array/gte_gte_spec.rb
401
404
  - spec/open_classes/array/to_html_table_spec.rb
402
405
  - spec/open_classes/array/to_table_spec.rb
403
406
  - spec/open_classes/array/together_at_spec.rb