tbpgr_utils 0.0.116 → 0.0.117
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rubocop.yml +51 -0
- data/README.md +13 -1
- data/Rakefile +8 -8
- data/lib/attributes_initializable.rb +3 -3
- data/lib/eval_helper/attr_init_class_code.rb +1 -1
- data/lib/eval_helper/times_code.rb +2 -2
- data/lib/markdown/heading.rb +32 -32
- data/lib/open_classes/array/kernel_send.rb +15 -0
- data/lib/open_classes/array/to_table.rb +1 -1
- data/lib/open_classes/array.rb +1 -0
- data/lib/open_classes/kernel/aa_ancestors.rb +16 -16
- data/lib/open_classes/kernel/p_evals.rb +42 -42
- data/lib/open_classes/string/heading_helper.rb +1 -1
- data/lib/open_classes/string/stripe.rb +1 -1
- data/lib/open_classes/string/to_hatena_heading.rb +35 -35
- data/lib/open_classes/string/to_markdown_heading.rb +37 -37
- data/lib/open_classes/string/to_space2_heading.rb +35 -35
- data/lib/open_classes/string/to_space4_heading.rb +35 -35
- data/lib/open_classes/string/to_tab_heading.rb +35 -35
- data/lib/simple_tournament.rb +57 -57
- data/lib/tbpgr_utils/version.rb +1 -1
- data/rubocop-todo.yml +33 -33
- data/spec/markdown/heading_spec.rb +4 -4
- data/spec/markdown/ol_spec.rb +1 -1
- data/spec/markdown/ul_spec.rb +1 -1
- data/spec/open_classes/array/kernel_send_spec.rb +43 -0
- data/spec/open_classes/array/together_at_spec.rb +61 -61
- data/spec/open_classes/array/together_clear_spec.rb +51 -51
- data/spec/open_classes/array/together_concat_spec.rb +53 -53
- data/spec/open_classes/array/together_delete_at_spec.rb +78 -78
- data/spec/open_classes/array/together_delete_if_spec.rb +61 -61
- data/spec/open_classes/array/together_delete_spec.rb +80 -80
- data/spec/open_classes/array/together_fill_spec.rb +79 -79
- data/spec/open_classes/array/together_map_spec.rb +171 -171
- data/spec/open_classes/array/together_spec.rb +51 -51
- data/spec/open_classes/array/together_with_index_spec.rb +51 -51
- data/spec/open_classes/object/any_of_spec.rb +72 -72
- data/spec/set_variables_code_spec.rb +2 -1
- data/tbpgr_utils.gemspec +27 -27
- metadata +41 -26
@@ -1,51 +1,51 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'spec_helper'
|
3
|
-
require 'tbpgr_utils'
|
4
|
-
|
5
|
-
describe Array do
|
6
|
-
context :together_with_index do
|
7
|
-
cases = [
|
8
|
-
{
|
9
|
-
case_no: 1,
|
10
|
-
case_title: 'valid case',
|
11
|
-
inputs: [[1, 2, 3], %w
|
12
|
-
expected: ['0:1:one', '1:2:two', '2:3:three'],
|
13
|
-
},
|
14
|
-
{
|
15
|
-
case_no: 2,
|
16
|
-
case_title: 'contain nil case',
|
17
|
-
inputs: [[1, 2, 3], %w
|
18
|
-
expected: ['0:1:one', '1:2:two', '2:3:'],
|
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 = []
|
32
|
-
c[:inputs].together_with_index do |first, second, index|
|
33
|
-
actual << "#{index
|
34
|
-
end
|
35
|
-
|
36
|
-
expect(actual).to eq(c[:expected])
|
37
|
-
ensure
|
38
|
-
case_after c
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
def case_before(c)
|
43
|
-
# implement each case before
|
44
|
-
end
|
45
|
-
|
46
|
-
def case_after(c)
|
47
|
-
# implement each case after
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
require 'tbpgr_utils'
|
4
|
+
|
5
|
+
describe Array do
|
6
|
+
context :together_with_index do
|
7
|
+
cases = [
|
8
|
+
{
|
9
|
+
case_no: 1,
|
10
|
+
case_title: 'valid case',
|
11
|
+
inputs: [[1, 2, 3], %w(one two three)],
|
12
|
+
expected: ['0:1:one', '1:2:two', '2:3:three'],
|
13
|
+
},
|
14
|
+
{
|
15
|
+
case_no: 2,
|
16
|
+
case_title: 'contain nil case',
|
17
|
+
inputs: [[1, 2, 3], %w(one two)],
|
18
|
+
expected: ['0:1:one', '1:2:two', '2:3:'],
|
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 = []
|
32
|
+
c[:inputs].together_with_index do |first, second, index|
|
33
|
+
actual << "#{index}:#{first}:#{second}"
|
34
|
+
end
|
35
|
+
|
36
|
+
expect(actual).to eq(c[:expected])
|
37
|
+
ensure
|
38
|
+
case_after c
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def case_before(c)
|
43
|
+
# implement each case before
|
44
|
+
end
|
45
|
+
|
46
|
+
def case_after(c)
|
47
|
+
# implement each case after
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -1,72 +1,72 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'spec_helper'
|
3
|
-
require 'tbpgr_utils'
|
4
|
-
|
5
|
-
describe Object do
|
6
|
-
context :any_of? do
|
7
|
-
cases = [
|
8
|
-
{
|
9
|
-
case_no: 1,
|
10
|
-
case_title: 'true case',
|
11
|
-
input: 'hoge',
|
12
|
-
check: %w
|
13
|
-
expected: true,
|
14
|
-
},
|
15
|
-
{
|
16
|
-
case_no: 2,
|
17
|
-
case_title: 'true case',
|
18
|
-
input: 'hige',
|
19
|
-
check: %w
|
20
|
-
expected: true,
|
21
|
-
},
|
22
|
-
{
|
23
|
-
case_no: 3,
|
24
|
-
case_title: 'false case',
|
25
|
-
input: 'hege',
|
26
|
-
check: %w
|
27
|
-
expected: false,
|
28
|
-
},
|
29
|
-
{
|
30
|
-
case_no: 4,
|
31
|
-
case_title: 'number true case',
|
32
|
-
input: 1,
|
33
|
-
check: [1, 2, 3, 4, 5],
|
34
|
-
expected: true,
|
35
|
-
},
|
36
|
-
{
|
37
|
-
case_no: 5,
|
38
|
-
case_title: 'number true case',
|
39
|
-
input: 6,
|
40
|
-
check: [1, 2, 3, 4, 5],
|
41
|
-
expected: false,
|
42
|
-
},
|
43
|
-
]
|
44
|
-
|
45
|
-
cases.each do |c|
|
46
|
-
it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
|
47
|
-
begin
|
48
|
-
case_before c
|
49
|
-
|
50
|
-
# -- given --
|
51
|
-
# nothing
|
52
|
-
|
53
|
-
# -- when --
|
54
|
-
actual = c[:input].any_of?(*c[:check])
|
55
|
-
|
56
|
-
# -- then --
|
57
|
-
expect(actual).to eq(c[:expected])
|
58
|
-
ensure
|
59
|
-
case_after c
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
def case_before(c)
|
64
|
-
# implement each case before
|
65
|
-
end
|
66
|
-
|
67
|
-
def case_after(c)
|
68
|
-
# implement each case after
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
require 'tbpgr_utils'
|
4
|
+
|
5
|
+
describe Object do
|
6
|
+
context :any_of? do
|
7
|
+
cases = [
|
8
|
+
{
|
9
|
+
case_no: 1,
|
10
|
+
case_title: 'true case',
|
11
|
+
input: 'hoge',
|
12
|
+
check: %w(hoge hige),
|
13
|
+
expected: true,
|
14
|
+
},
|
15
|
+
{
|
16
|
+
case_no: 2,
|
17
|
+
case_title: 'true case',
|
18
|
+
input: 'hige',
|
19
|
+
check: %w(hoge hige),
|
20
|
+
expected: true,
|
21
|
+
},
|
22
|
+
{
|
23
|
+
case_no: 3,
|
24
|
+
case_title: 'false case',
|
25
|
+
input: 'hege',
|
26
|
+
check: %w(hoge hige),
|
27
|
+
expected: false,
|
28
|
+
},
|
29
|
+
{
|
30
|
+
case_no: 4,
|
31
|
+
case_title: 'number true case',
|
32
|
+
input: 1,
|
33
|
+
check: [1, 2, 3, 4, 5],
|
34
|
+
expected: true,
|
35
|
+
},
|
36
|
+
{
|
37
|
+
case_no: 5,
|
38
|
+
case_title: 'number true case',
|
39
|
+
input: 6,
|
40
|
+
check: [1, 2, 3, 4, 5],
|
41
|
+
expected: false,
|
42
|
+
},
|
43
|
+
]
|
44
|
+
|
45
|
+
cases.each do |c|
|
46
|
+
it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
|
47
|
+
begin
|
48
|
+
case_before c
|
49
|
+
|
50
|
+
# -- given --
|
51
|
+
# nothing
|
52
|
+
|
53
|
+
# -- when --
|
54
|
+
actual = c[:input].any_of?(*c[:check])
|
55
|
+
|
56
|
+
# -- then --
|
57
|
+
expect(actual).to eq(c[:expected])
|
58
|
+
ensure
|
59
|
+
case_after c
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def case_before(c)
|
64
|
+
# implement each case before
|
65
|
+
end
|
66
|
+
|
67
|
+
def case_after(c)
|
68
|
+
# implement each case after
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
data/tbpgr_utils.gemspec
CHANGED
@@ -1,27 +1,27 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'tbpgr_utils/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
8
|
-
spec.version = TbpgrUtils::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
11
|
-
spec.description = %q
|
12
|
-
spec.summary = %q
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
15
|
-
|
16
|
-
spec.files = `git ls-files`.split(
|
17
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
-
spec.require_paths = [
|
20
|
-
|
21
|
-
spec.add_runtime_dependency
|
22
|
-
|
23
|
-
spec.add_development_dependency
|
24
|
-
spec.add_development_dependency
|
25
|
-
spec.add_development_dependency
|
26
|
-
spec.add_development_dependency
|
27
|
-
end
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'tbpgr_utils/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'tbpgr_utils'
|
8
|
+
spec.version = TbpgrUtils::VERSION
|
9
|
+
spec.authors = ['tbpgr']
|
10
|
+
spec.email = ['tbpgr@tbpgr.jp']
|
11
|
+
spec.description = %q(Utilities)
|
12
|
+
spec.summary = %q(Utilities)
|
13
|
+
spec.homepage = 'https://github.com/tbpgr/tbpgr_utils'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_runtime_dependency 'activesupport', '~> 4.0.1'
|
22
|
+
|
23
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
24
|
+
spec.add_development_dependency 'rake'
|
25
|
+
spec.add_development_dependency 'rspec', '~> 2.14.1'
|
26
|
+
spec.add_development_dependency 'simplecov', '~> 0.8.2'
|
27
|
+
end
|
metadata
CHANGED
@@ -1,71 +1,85 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tbpgr_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.117
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- tbpgr
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-04 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: activesupport
|
16
|
-
requirement:
|
17
|
-
none: false
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: 4.0.1
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
|
-
version_requirements:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 4.0.1
|
25
27
|
- !ruby/object:Gem::Dependency
|
26
28
|
name: bundler
|
27
|
-
requirement:
|
28
|
-
none: false
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
29
30
|
requirements:
|
30
31
|
- - ~>
|
31
32
|
- !ruby/object:Gem::Version
|
32
33
|
version: '1.3'
|
33
34
|
type: :development
|
34
35
|
prerelease: false
|
35
|
-
version_requirements:
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.3'
|
36
41
|
- !ruby/object:Gem::Dependency
|
37
42
|
name: rake
|
38
|
-
requirement:
|
39
|
-
none: false
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
40
44
|
requirements:
|
41
|
-
- -
|
45
|
+
- - '>='
|
42
46
|
- !ruby/object:Gem::Version
|
43
47
|
version: '0'
|
44
48
|
type: :development
|
45
49
|
prerelease: false
|
46
|
-
version_requirements:
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
47
55
|
- !ruby/object:Gem::Dependency
|
48
56
|
name: rspec
|
49
|
-
requirement:
|
50
|
-
none: false
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
51
58
|
requirements:
|
52
59
|
- - ~>
|
53
60
|
- !ruby/object:Gem::Version
|
54
61
|
version: 2.14.1
|
55
62
|
type: :development
|
56
63
|
prerelease: false
|
57
|
-
version_requirements:
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.14.1
|
58
69
|
- !ruby/object:Gem::Dependency
|
59
70
|
name: simplecov
|
60
|
-
requirement:
|
61
|
-
none: false
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
62
72
|
requirements:
|
63
73
|
- - ~>
|
64
74
|
- !ruby/object:Gem::Version
|
65
75
|
version: 0.8.2
|
66
76
|
type: :development
|
67
77
|
prerelease: false
|
68
|
-
version_requirements:
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.8.2
|
69
83
|
description: Utilities
|
70
84
|
email:
|
71
85
|
- tbpgr@tbpgr.jp
|
@@ -122,6 +136,7 @@ files:
|
|
122
136
|
- lib/metasyntactic_variable.rb
|
123
137
|
- lib/open_classes/array.rb
|
124
138
|
- lib/open_classes/array/gte_gte.rb
|
139
|
+
- lib/open_classes/array/kernel_send.rb
|
125
140
|
- lib/open_classes/array/to_html_table.rb
|
126
141
|
- lib/open_classes/array/to_table.rb
|
127
142
|
- lib/open_classes/array/together.rb
|
@@ -253,6 +268,7 @@ files:
|
|
253
268
|
- spec/markdown/ul_spec.rb
|
254
269
|
- spec/metasyntactic_variable_spec.rb
|
255
270
|
- spec/open_classes/array/gte_gte_spec.rb
|
271
|
+
- spec/open_classes/array/kernel_send_spec.rb
|
256
272
|
- spec/open_classes/array/to_html_table_spec.rb
|
257
273
|
- spec/open_classes/array/to_table_spec.rb
|
258
274
|
- spec/open_classes/array/together_at_spec.rb
|
@@ -347,27 +363,26 @@ files:
|
|
347
363
|
homepage: https://github.com/tbpgr/tbpgr_utils
|
348
364
|
licenses:
|
349
365
|
- MIT
|
366
|
+
metadata: {}
|
350
367
|
post_install_message:
|
351
368
|
rdoc_options: []
|
352
369
|
require_paths:
|
353
370
|
- lib
|
354
371
|
required_ruby_version: !ruby/object:Gem::Requirement
|
355
|
-
none: false
|
356
372
|
requirements:
|
357
|
-
- -
|
373
|
+
- - '>='
|
358
374
|
- !ruby/object:Gem::Version
|
359
375
|
version: '0'
|
360
376
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
361
|
-
none: false
|
362
377
|
requirements:
|
363
|
-
- -
|
378
|
+
- - '>='
|
364
379
|
- !ruby/object:Gem::Version
|
365
380
|
version: '0'
|
366
381
|
requirements: []
|
367
382
|
rubyforge_project:
|
368
|
-
rubygems_version:
|
383
|
+
rubygems_version: 2.0.14
|
369
384
|
signing_key:
|
370
|
-
specification_version:
|
385
|
+
specification_version: 4
|
371
386
|
summary: Utilities
|
372
387
|
test_files:
|
373
388
|
- spec/attributes_hashable_spec.rb
|
@@ -401,6 +416,7 @@ test_files:
|
|
401
416
|
- spec/markdown/ul_spec.rb
|
402
417
|
- spec/metasyntactic_variable_spec.rb
|
403
418
|
- spec/open_classes/array/gte_gte_spec.rb
|
419
|
+
- spec/open_classes/array/kernel_send_spec.rb
|
404
420
|
- spec/open_classes/array/to_html_table_spec.rb
|
405
421
|
- spec/open_classes/array/to_table_spec.rb
|
406
422
|
- spec/open_classes/array/together_at_spec.rb
|
@@ -491,4 +507,3 @@ test_files:
|
|
491
507
|
- spec/templatable_spec.rb
|
492
508
|
- spec/template_methodable_spec.rb
|
493
509
|
- spec/test_toolbox/kernel_spec.rb
|
494
|
-
has_rdoc:
|