tbpgr_utils 0.0.88 → 0.0.89

Sign up to get free protection for your applications and to get access to all the features.
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_quote](#stringescape_quote) |escape quote |
113
114
  |[TbpgrUtils String#escape_double_quote](#stringescape_double_quote) |escape double quote |
114
115
  |[TbpgrUtils String#hyphen_to_a](#stringhyphen_to_a) |hyphen-format string to array |
115
116
  |[TbpgrUtils String#is_meta_variable?](#stringis_meta_variable) |is meta variable. |
@@ -2530,6 +2531,14 @@ require 'tbpgr_utils'
2530
2531
 
2531
2532
  [back to list](#list)
2532
2533
 
2534
+ ### String#escape_quote
2535
+ ~~~ruby
2536
+ require 'tbpgr_utils'
2537
+ "hoge'hige".escape_quote # => "hoge''hige"
2538
+ ~~~
2539
+
2540
+ [back to list](#list)
2541
+
2533
2542
  ### String#escape_double_quote
2534
2543
  ~~~ruby
2535
2544
  require 'tbpgr_utils'
@@ -2945,6 +2954,7 @@ if you are Sublime Text2 user, you can use snippet for TbpgrUtils.
2945
2954
  https://github.com/tbpgr/tbpgr_utils_snippets
2946
2955
 
2947
2956
  ## History
2957
+ * version 0.0.89 : add String#escape_quote
2948
2958
  * version 0.0.88 : add String#escape_double_quote
2949
2959
  * version 0.0.87 : add String#spacing
2950
2960
  * version 0.0.86 : add Familyable
@@ -0,0 +1,13 @@
1
+ # encoding: utf-8
2
+
3
+ class String
4
+ # escape double quote.
5
+ #
6
+ # ==== Examples
7
+ #
8
+ # "hoge'hige".escape_quote # => "hoge''hige"
9
+ #
10
+ def escape_quote
11
+ gsub("'", "''")
12
+ end
13
+ end
@@ -3,6 +3,7 @@ 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
5
  require 'open_classes/string/escape_double_quote'
6
+ require 'open_classes/string/escape_quote'
6
7
  require 'open_classes/string/hyphen_to_a'
7
8
  require 'open_classes/string/is_meta_variable'
8
9
  require 'open_classes/string/justify_table'
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Tbpgr Utilities
4
4
  module TbpgrUtils
5
- VERSION = '0.0.88'
5
+ VERSION = '0.0.89'
6
6
  end
@@ -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.88
4
+ version: 0.0.89
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-05 00:00:00.000000000 Z
12
+ date: 2014-04-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
16
- requirement: &20614140 !ruby/object:Gem::Requirement
16
+ requirement: &29555100 !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: *20614140
24
+ version_requirements: *29555100
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: bundler
27
- requirement: &20613852 !ruby/object:Gem::Requirement
27
+ requirement: &29554812 !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: *20613852
35
+ version_requirements: *29554812
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rake
38
- requirement: &20613624 !ruby/object:Gem::Requirement
38
+ requirement: &29554584 !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: *20613624
46
+ version_requirements: *29554584
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rspec
49
- requirement: &20613300 !ruby/object:Gem::Requirement
49
+ requirement: &29554260 !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: *20613300
57
+ version_requirements: *29554260
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: simplecov
60
- requirement: &20613000 !ruby/object:Gem::Requirement
60
+ requirement: &29553960 !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: *20613000
68
+ version_requirements: *29553960
69
69
  description: Utilities
70
70
  email:
71
71
  - tbpgr@tbpgr.jp
@@ -171,6 +171,7 @@ files:
171
171
  - lib/open_classes/string/ascii_unicode_table.rb
172
172
  - lib/open_classes/string/comma_to_a.rb
173
173
  - lib/open_classes/string/escape_double_quote.rb
174
+ - lib/open_classes/string/escape_quote.rb
174
175
  - lib/open_classes/string/heading_helper.rb
175
176
  - lib/open_classes/string/hyphen_to_a.rb
176
177
  - lib/open_classes/string/is_meta_variable.rb
@@ -271,6 +272,7 @@ files:
271
272
  - spec/open_classes/string/ascii_unicode_table_spec.rb
272
273
  - spec/open_classes/string/comma_to_a_spec.rb
273
274
  - spec/open_classes/string/escape_double_quote_spec.rb
275
+ - spec/open_classes/string/escape_quote_spec.rb
274
276
  - spec/open_classes/string/hyphen_to_a_spec.rb
275
277
  - spec/open_classes/string/is_meta_variable_spec.rb
276
278
  - spec/open_classes/string/justify_table_spec.rb
@@ -394,6 +396,7 @@ test_files:
394
396
  - spec/open_classes/string/ascii_unicode_table_spec.rb
395
397
  - spec/open_classes/string/comma_to_a_spec.rb
396
398
  - spec/open_classes/string/escape_double_quote_spec.rb
399
+ - spec/open_classes/string/escape_quote_spec.rb
397
400
  - spec/open_classes/string/hyphen_to_a_spec.rb
398
401
  - spec/open_classes/string/is_meta_variable_spec.rb
399
402
  - spec/open_classes/string/justify_table_spec.rb