tbpgr_utils 0.0.117 → 0.0.118

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 813189dd7e2699c513dae05b50d5f841d6e4a7b1
4
- data.tar.gz: 6be348d263542c013e45cc81e80475397b386f4b
3
+ metadata.gz: bdc866278f30602046eacc114095ccf40bf10d95
4
+ data.tar.gz: b1035b2b9baae0c6bb163a4e28298f7e3770e26f
5
5
  SHA512:
6
- metadata.gz: e1479071b4c5feec294716ce25aad060e9f7f8559398234a2af3b1bc913a09355f3df92bcf170654859f4556bbf7e8047f93933f7c636a0d9d3b0d1b6f08c4b5
7
- data.tar.gz: bf240a5a702bb16b636815c8aae1adb783193a16550cebbe3b764aa1fc4ea4b309bdf7a591888b3b6eeee1f853ee93e6ac9166154627d35f9fc989bd8da5931f
6
+ metadata.gz: 706a1169f5a97e1d060fc7dadf67664dc4a8fdbb5c24fcb7258d21ec0c03316b943b740eecd95cd9adc2b5119e12deed76f1e75335ef96e1d233c2d595819331
7
+ data.tar.gz: a070d66982be48a65f1287f48b264cfe7ee1f05ad4136846b016430f6f5316db9df93f7505a7c480bfd725f519db54c2644a37c140e43bd799562ee18c0720ef
data/README.md CHANGED
@@ -153,7 +153,7 @@ Or install it yourself as:
153
153
  |[TbpgrUtils String#to_space4_heading](#stringto_space4_heading) |create space4-format heading string with Emmet-like grammar |
154
154
  |[TbpgrUtils String#to_tab_heading](#stringto_tab_heading) |create tab-format heading string with Emmet-like grammar |
155
155
  |[TbpgrUtils String#unescape_double_quote](#stringunescape_double_quote) |unescape double quote |
156
- |[TbpgrUtils String#unescape_quote](#stringunescape_quote) |unescape single quote |
156
+ |[TbpgrUtils String#uniq](#stringuniq) |return uniq string |
157
157
  |[TbpgrUtils String#winpath_to_cygwinpath](#stringwinpath_to_cygwinpath) |convert windows path to cygwin path |
158
158
  |[TbpgrUtils Symbol#is_meta_variable?](#symbolis_meta_variable) |is meta variable. |
159
159
  |[Templatable module](#templatable) |get result from template + placeholder |
@@ -3417,6 +3417,14 @@ require 'tbpgr_utils'
3417
3417
 
3418
3418
  [back to list](#list)
3419
3419
 
3420
+ ### String#uniq
3421
+ ~~~ruby
3422
+ require 'tbpgr_utils'
3423
+ 'abcdac'.uniq # => 'abcd'
3424
+ ~~~
3425
+
3426
+ [back to list](#list)
3427
+
3420
3428
  ### String#winpath_to_cygwinpath
3421
3429
  ~~~ruby
3422
3430
  require 'tbpgr_utils'
@@ -3535,6 +3543,7 @@ if you are Sublime Text2 user, you can use snippet for TbpgrUtils.
3535
3543
  https://github.com/tbpgr/tbpgr_utils_snippets
3536
3544
 
3537
3545
  ## History
3546
+ * version 0.0.118 : add String#uniq
3538
3547
  * version 0.0.117 : add Array#kernel_send
3539
3548
  * version 0.0.116 : add Array#>>
3540
3549
  * version 0.0.115 : add MarkdownString#codes
@@ -21,4 +21,5 @@ require 'open_classes/string/to_space4_heading'
21
21
  require 'open_classes/string/to_tab_heading'
22
22
  require 'open_classes/string/unescape_double_quote'
23
23
  require 'open_classes/string/unescape_quote'
24
+ require 'open_classes/string/uniq'
24
25
  require 'open_classes/string/winpath_to_cygwinpath'
@@ -0,0 +1,13 @@
1
+ # encoding: utf-8
2
+
3
+ class String
4
+ # return uniq string
5
+ #
6
+ # ==== Examples
7
+ #
8
+ # 'abcdac'.uniq # => 'abcd'
9
+ #
10
+ def uniq
11
+ split('').uniq.join
12
+ end
13
+ end
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Tbpgr Utilities
4
4
  module TbpgrUtils
5
- VERSION = '0.0.117'
5
+ VERSION = '0.0.118'
6
6
  end
@@ -0,0 +1,55 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+ require 'open_classes/string/uniq'
4
+
5
+ describe String do
6
+ context :uniq do
7
+ cases = [
8
+ {
9
+ case_no: 1,
10
+ case_title: 'normal case',
11
+ input: 'abcdac',
12
+ expected: 'abcd',
13
+ },
14
+ {
15
+ case_no: 2,
16
+ case_title: 'not exist duplication case',
17
+ input: 'abc',
18
+ expected: 'abc',
19
+ },
20
+ {
21
+ case_no: 3,
22
+ case_title: 'empty case',
23
+ input: '',
24
+ expected: '',
25
+ },
26
+ ]
27
+
28
+ cases.each do |c|
29
+ it "|case_no=#{c[:case_no]}|case_title=#{c[:case_title]}" do
30
+ begin
31
+ case_before c
32
+
33
+ # -- given --
34
+ # nothing
35
+
36
+ # -- when --
37
+ actual = c[:input].uniq
38
+
39
+ # -- then --
40
+ expect(actual).to eq(c[:expected])
41
+ ensure
42
+ case_after c
43
+ end
44
+ end
45
+
46
+ def case_before(c)
47
+ # implement each case before
48
+ end
49
+
50
+ def case_after(c)
51
+ # implement each case after
52
+ end
53
+ end
54
+ end
55
+ 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.117
4
+ version: 0.0.118
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-04 00:00:00.000000000 Z
11
+ date: 2014-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -226,6 +226,7 @@ files:
226
226
  - lib/open_classes/string/to_tab_heading.rb
227
227
  - lib/open_classes/string/unescape_double_quote.rb
228
228
  - lib/open_classes/string/unescape_quote.rb
229
+ - lib/open_classes/string/uniq.rb
229
230
  - lib/open_classes/string/winpath_to_cygwinpath.rb
230
231
  - lib/open_classes/symbol.rb
231
232
  - lib/open_classes/symbol/is_meta_variable.rb
@@ -351,6 +352,7 @@ files:
351
352
  - spec/open_classes/string/to_tab_heading_spec.rb
352
353
  - spec/open_classes/string/unescape_double_quote_spec.rb
353
354
  - spec/open_classes/string/unescape_quote_spec.rb
355
+ - spec/open_classes/string/uniq_spec.rb
354
356
  - spec/open_classes/string/winpath_to_cygwinpath_spec.rb
355
357
  - spec/open_classes/symbol/is_meta_variable_spec.rb
356
358
  - spec/set_variables_code_spec.rb
@@ -499,6 +501,7 @@ test_files:
499
501
  - spec/open_classes/string/to_tab_heading_spec.rb
500
502
  - spec/open_classes/string/unescape_double_quote_spec.rb
501
503
  - spec/open_classes/string/unescape_quote_spec.rb
504
+ - spec/open_classes/string/uniq_spec.rb
502
505
  - spec/open_classes/string/winpath_to_cygwinpath_spec.rb
503
506
  - spec/open_classes/symbol/is_meta_variable_spec.rb
504
507
  - spec/set_variables_code_spec.rb