tbpgr_utils 0.0.87 → 0.0.88
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 +10 -0
- data/lib/open_classes/string/escape_double_quote.rb +13 -0
- data/lib/open_classes/string/spacing.rb +2 -3
- data/lib/open_classes/string.rb +1 -0
- data/lib/tbpgr_utils/version.rb +1 -1
- data/spec/familyable/familyable_spec.rb +3 -3
- data/spec/open_classes/string/escape_double_quote_spec.rb +49 -0
- metadata +15 -12
data/README.md
CHANGED
@@ -110,6 +110,7 @@ Or install it yourself as:
|
|
110
110
|
|[TbpgrUtils String#ascii1_other2_size](#stringascii1_other2_size) |count string size. ascii => count1, not ascii => count2 |
|
111
111
|
|[TbpgrUtils String#ascii_unicode_table](#stringascii_unicode_table) |get ascii_unicode_table |
|
112
112
|
|[TbpgrUtils String#comma_to_a](#stringcomma_to_a) |comma-format string to array |
|
113
|
+
|[TbpgrUtils String#escape_double_quote](#stringescape_double_quote) |escape double quote |
|
113
114
|
|[TbpgrUtils String#hyphen_to_a](#stringhyphen_to_a) |hyphen-format string to array |
|
114
115
|
|[TbpgrUtils String#is_meta_variable?](#stringis_meta_variable) |is meta variable. |
|
115
116
|
|[TbpgrUtils String#justify_table](#stringjustify_table) |justify pipe format table string |
|
@@ -2529,6 +2530,14 @@ require 'tbpgr_utils'
|
|
2529
2530
|
|
2530
2531
|
[back to list](#list)
|
2531
2532
|
|
2533
|
+
### String#escape_double_quote
|
2534
|
+
~~~ruby
|
2535
|
+
require 'tbpgr_utils'
|
2536
|
+
'hoge"hige'.escape_double_quote # => 'hoge""hige'
|
2537
|
+
~~~
|
2538
|
+
|
2539
|
+
[back to list](#list)
|
2540
|
+
|
2532
2541
|
### String#hyphen_to_a
|
2533
2542
|
number case
|
2534
2543
|
|
@@ -2936,6 +2945,7 @@ if you are Sublime Text2 user, you can use snippet for TbpgrUtils.
|
|
2936
2945
|
https://github.com/tbpgr/tbpgr_utils_snippets
|
2937
2946
|
|
2938
2947
|
## History
|
2948
|
+
* version 0.0.88 : add String#escape_double_quote
|
2939
2949
|
* version 0.0.87 : add String#spacing
|
2940
2950
|
* version 0.0.86 : add Familyable
|
2941
2951
|
* version 0.0.85 : add String#table_to_array
|
@@ -11,10 +11,9 @@ class String
|
|
11
11
|
# hoge.spacing # => 'h o g e'
|
12
12
|
# hoge.spacing({char: '_', size: 2}) # => 'h__o__g__e'
|
13
13
|
#
|
14
|
-
def spacing(options = {char: ' ', size: 1})
|
14
|
+
def spacing(options = { char: ' ', size: 1 })
|
15
15
|
options[:char] = ' ' unless options[:char]
|
16
16
|
options[:size] = 1 unless options[:size]
|
17
|
-
|
17
|
+
chars.to_a.join(options[:char] * options[:size])
|
18
18
|
end
|
19
19
|
end
|
20
|
-
|
data/lib/open_classes/string.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
require 'open_classes/string/ascii1_other2_size'
|
3
3
|
require 'open_classes/string/ascii_unicode_table'
|
4
4
|
require 'open_classes/string/comma_to_a'
|
5
|
+
require 'open_classes/string/escape_double_quote'
|
5
6
|
require 'open_classes/string/hyphen_to_a'
|
6
7
|
require 'open_classes/string/is_meta_variable'
|
7
8
|
require 'open_classes/string/justify_table'
|
data/lib/tbpgr_utils/version.rb
CHANGED
@@ -11,7 +11,7 @@ describe Familyable::Family do
|
|
11
11
|
persons: [
|
12
12
|
a = Familyable::Person.new(id: 1, parent_ids: [2, 3]),
|
13
13
|
b = Familyable::Person.new(id: 2, parent_ids: []),
|
14
|
-
c = Familyable::Person.new(id: 3, parent_ids: [4],
|
14
|
+
c = Familyable::Person.new(id: 3, parent_ids: [4],),
|
15
15
|
d = Familyable::Person.new(id: 4, parent_ids: []),
|
16
16
|
e = Familyable::Person.new(id: 5, parent_ids: [2]),
|
17
17
|
],
|
@@ -59,7 +59,7 @@ describe Familyable::Family do
|
|
59
59
|
persons: [
|
60
60
|
a = Familyable::Person.new(id: 1, parent_ids: [2, 3]),
|
61
61
|
b = Familyable::Person.new(id: 2, parent_ids: []),
|
62
|
-
c = Familyable::Person.new(id: 3, parent_ids: [4],
|
62
|
+
c = Familyable::Person.new(id: 3, parent_ids: [4],),
|
63
63
|
d = Familyable::Person.new(id: 4, parent_ids: []),
|
64
64
|
e = Familyable::Person.new(id: 5, parent_ids: [2]),
|
65
65
|
],
|
@@ -107,7 +107,7 @@ describe Familyable::Family do
|
|
107
107
|
persons: [
|
108
108
|
a = Familyable::Person.new(id: 1, parent_ids: [2, 3]),
|
109
109
|
b = Familyable::Person.new(id: 2, parent_ids: []),
|
110
|
-
c = Familyable::Person.new(id: 3, parent_ids: [4],
|
110
|
+
c = Familyable::Person.new(id: 3, parent_ids: [4],),
|
111
111
|
d = Familyable::Person.new(id: 4, parent_ids: [3]),
|
112
112
|
e = Familyable::Person.new(id: 5, parent_ids: [2]),
|
113
113
|
],
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
require 'open_classes/string/escape_double_quote'
|
4
|
+
|
5
|
+
describe String do
|
6
|
+
context :escape_double_quote do
|
7
|
+
cases = [
|
8
|
+
{
|
9
|
+
case_no: 1,
|
10
|
+
case_title: 'exist double quote case',
|
11
|
+
input: 'hoge"h"ige',
|
12
|
+
expected: 'hoge""h""ige',
|
13
|
+
},
|
14
|
+
{
|
15
|
+
case_no: 2,
|
16
|
+
case_title: 'not exist double quote case',
|
17
|
+
input: 'hogehige',
|
18
|
+
expected: 'hogehige',
|
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 --
|
31
|
+
actual = c[:input].escape_double_quote
|
32
|
+
|
33
|
+
# -- then --
|
34
|
+
expect(actual).to eq(c[:expected])
|
35
|
+
ensure
|
36
|
+
case_after c
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def case_before(c)
|
41
|
+
# implement each case before
|
42
|
+
end
|
43
|
+
|
44
|
+
def case_after(c)
|
45
|
+
# implement each case after
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
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.
|
4
|
+
version: 0.0.88
|
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-04-
|
12
|
+
date: 2014-04-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
16
|
-
requirement: &
|
16
|
+
requirement: &20614140 !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: *
|
24
|
+
version_requirements: *20614140
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: bundler
|
27
|
-
requirement: &
|
27
|
+
requirement: &20613852 !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: *
|
35
|
+
version_requirements: *20613852
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rake
|
38
|
-
requirement: &
|
38
|
+
requirement: &20613624 !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: *
|
46
|
+
version_requirements: *20613624
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rspec
|
49
|
-
requirement: &
|
49
|
+
requirement: &20613300 !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: *
|
57
|
+
version_requirements: *20613300
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: simplecov
|
60
|
-
requirement: &
|
60
|
+
requirement: &20613000 !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: *
|
68
|
+
version_requirements: *20613000
|
69
69
|
description: Utilities
|
70
70
|
email:
|
71
71
|
- tbpgr@tbpgr.jp
|
@@ -170,6 +170,7 @@ files:
|
|
170
170
|
- lib/open_classes/string/ascii1_other2_size.rb
|
171
171
|
- lib/open_classes/string/ascii_unicode_table.rb
|
172
172
|
- lib/open_classes/string/comma_to_a.rb
|
173
|
+
- lib/open_classes/string/escape_double_quote.rb
|
173
174
|
- lib/open_classes/string/heading_helper.rb
|
174
175
|
- lib/open_classes/string/hyphen_to_a.rb
|
175
176
|
- lib/open_classes/string/is_meta_variable.rb
|
@@ -269,6 +270,7 @@ files:
|
|
269
270
|
- spec/open_classes/string/ascii1_other2_size_spec.rb
|
270
271
|
- spec/open_classes/string/ascii_unicode_table_spec.rb
|
271
272
|
- spec/open_classes/string/comma_to_a_spec.rb
|
273
|
+
- spec/open_classes/string/escape_double_quote_spec.rb
|
272
274
|
- spec/open_classes/string/hyphen_to_a_spec.rb
|
273
275
|
- spec/open_classes/string/is_meta_variable_spec.rb
|
274
276
|
- spec/open_classes/string/justify_table_spec.rb
|
@@ -391,6 +393,7 @@ test_files:
|
|
391
393
|
- spec/open_classes/string/ascii1_other2_size_spec.rb
|
392
394
|
- spec/open_classes/string/ascii_unicode_table_spec.rb
|
393
395
|
- spec/open_classes/string/comma_to_a_spec.rb
|
396
|
+
- spec/open_classes/string/escape_double_quote_spec.rb
|
394
397
|
- spec/open_classes/string/hyphen_to_a_spec.rb
|
395
398
|
- spec/open_classes/string/is_meta_variable_spec.rb
|
396
399
|
- spec/open_classes/string/justify_table_spec.rb
|