tbpgr_utils 0.0.119 → 0.0.120
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 +4 -4
- data/README.md +2 -0
- data/lib/open_classes/array.rb +1 -0
- data/lib/open_classes/array/sum.rb +15 -0
- data/lib/tbpgr_utils/version.rb +1 -1
- data/spec/open_classes/array/sum_spec.rb +48 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e1b70999803bbab64b871782e8db0234e4a2bdb0
|
4
|
+
data.tar.gz: 9caf56eb84d02338a121dd04d846d24cb0cf097d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f5f7a0730044402893300645e6a500ea0ba950b955f8de9899778665ff6d78238690f15eb49479d8ecf653c7b38d632fe185d2a1e4ab33b8658855e4592f2b8
|
7
|
+
data.tar.gz: 5a61fe413bde0ebc771603c17aae78e3289c3d1d1a91982fbc025006df3dd8a33b5e35ce39c1f690edce023bbae97bc2ffc94630b31542714db663affce9ce0f
|
data/README.md
CHANGED
@@ -26,6 +26,7 @@ Or install it yourself as:
|
|
26
26
|
|:----------- |:------------ |
|
27
27
|
|[TbpgrUtils Array#>>](#array) |alias of map(&:method_symbol) |
|
28
28
|
|[TbpgrUtils Array#kernel_send](#arraykernel_send) |alias of map {|v|send :some_kernel_method, v} |
|
29
|
+
|[TbpgrUtils Array#sum](#arraysum) |alias of Array#reduce(&:+). |
|
29
30
|
|[TbpgrUtils Array#to_table](#arrayto_table) |Array(Array, Array...) to table format. |
|
30
31
|
|[TbpgrUtils Array#to_html_table](#arrayto_html_table) |Array(Array, Array...) to html table format. |
|
31
32
|
|[TbpgrUtils Array#together](#arraytogether) |loop all arrays by block |
|
@@ -3555,6 +3556,7 @@ if you are Sublime Text2 user, you can use snippet for TbpgrUtils.
|
|
3555
3556
|
https://github.com/tbpgr/tbpgr_utils_snippets
|
3556
3557
|
|
3557
3558
|
## History
|
3559
|
+
* version 0.0.120 : add Array#sum
|
3558
3560
|
* version 0.0.119 : add Kernel#exchange
|
3559
3561
|
* version 0.0.118 : add String#uniq
|
3560
3562
|
* version 0.0.117 : add Array#kernel_send
|
data/lib/open_classes/array.rb
CHANGED
data/lib/tbpgr_utils/version.rb
CHANGED
@@ -0,0 +1,48 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
require 'tbpgr_utils'
|
4
|
+
|
5
|
+
describe Array do
|
6
|
+
context :sum do
|
7
|
+
cases = [
|
8
|
+
{
|
9
|
+
case_no: 1,
|
10
|
+
case_title: 'numbers case',
|
11
|
+
input: [*1..5],
|
12
|
+
expected: 15,
|
13
|
+
},
|
14
|
+
{
|
15
|
+
case_no: 2,
|
16
|
+
case_title: 'charactors case',
|
17
|
+
input: [*'a'..'z'],
|
18
|
+
expected: 'abcdefghijklmnopqrstuvwxyz',
|
19
|
+
},
|
20
|
+
]
|
21
|
+
|
22
|
+
cases.each do |c|
|
23
|
+
it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
|
24
|
+
begin
|
25
|
+
case_before c
|
26
|
+
|
27
|
+
# -- given --
|
28
|
+
# nothing
|
29
|
+
|
30
|
+
# -- when/then --
|
31
|
+
actual = c[:input].sum
|
32
|
+
|
33
|
+
expect(actual).to eq(c[:expected])
|
34
|
+
ensure
|
35
|
+
case_after c
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def case_before(c)
|
40
|
+
# implement each case before
|
41
|
+
end
|
42
|
+
|
43
|
+
def case_after(c)
|
44
|
+
# implement each case after
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tbpgr_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.120
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- tbpgr
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -137,6 +137,7 @@ files:
|
|
137
137
|
- lib/open_classes/array.rb
|
138
138
|
- lib/open_classes/array/gte_gte.rb
|
139
139
|
- lib/open_classes/array/kernel_send.rb
|
140
|
+
- lib/open_classes/array/sum.rb
|
140
141
|
- lib/open_classes/array/to_html_table.rb
|
141
142
|
- lib/open_classes/array/to_table.rb
|
142
143
|
- lib/open_classes/array/together.rb
|
@@ -271,6 +272,7 @@ files:
|
|
271
272
|
- spec/metasyntactic_variable_spec.rb
|
272
273
|
- spec/open_classes/array/gte_gte_spec.rb
|
273
274
|
- spec/open_classes/array/kernel_send_spec.rb
|
275
|
+
- spec/open_classes/array/sum_spec.rb
|
274
276
|
- spec/open_classes/array/to_html_table_spec.rb
|
275
277
|
- spec/open_classes/array/to_table_spec.rb
|
276
278
|
- spec/open_classes/array/together_at_spec.rb
|
@@ -421,6 +423,7 @@ test_files:
|
|
421
423
|
- spec/metasyntactic_variable_spec.rb
|
422
424
|
- spec/open_classes/array/gte_gte_spec.rb
|
423
425
|
- spec/open_classes/array/kernel_send_spec.rb
|
426
|
+
- spec/open_classes/array/sum_spec.rb
|
424
427
|
- spec/open_classes/array/to_html_table_spec.rb
|
425
428
|
- spec/open_classes/array/to_table_spec.rb
|
426
429
|
- spec/open_classes/array/together_at_spec.rb
|