tbpgr_utils 0.0.126 → 0.0.127

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7b0fcf8a3c81962a24a4ea0a5e6e92c2ac19eff1
4
- data.tar.gz: f71b640fbba3be074cd181e6cae211d1d79397fb
3
+ metadata.gz: 4c4a2fe61b708e8b27e75368fd115028e037afd7
4
+ data.tar.gz: d27e099beff9f6be727fd71eef614332cbc3d8f7
5
5
  SHA512:
6
- metadata.gz: 8a0d4e6902e2646ecf200770cfe3b81951cec14467931af6caabf1afa7afbc63165cd91630fcb68245a0680adec9b6152c4e52e6283759764079f15617f0787e
7
- data.tar.gz: 2af0dfce8a2c49c14f35e671e42245cb7fcda1adb79c106c91829ef9e9efb9f547938133ded1613e3dc53a0a35bd1e9c83192dcfffbd1c83b6ef8ab2a7d2e314
6
+ metadata.gz: 059fd1a5e57efc3cd8f9c2d7e7129508562210efcdf18e32b93b4921ba197e02cbd94a696903623191f4cd2d39a933a6c4d73a85fbfe96e3114744d8a5794d12
7
+ data.tar.gz: 339a1e655dc420c4577bdce3e4567b5ccdea31e8e4a6b3fa882552dae38fcb35de2a5d5fbcbc3a452270c81414d39fdadffd0e02276be534e792116ebd84fc0e
data/README.md CHANGED
@@ -161,6 +161,7 @@ Or install it yourself as:
161
161
  |[TbpgrUtils String#to_tab_heading](#stringto_tab_heading) |create tab-format heading string with Emmet-like grammar |
162
162
  |[TbpgrUtils String#unescape_double_quote](#stringunescape_double_quote) |unescape double quote |
163
163
  |[TbpgrUtils String#uniq](#stringuniq) |return uniq string |
164
+ |[TbpgrUtils String#uniq_size](#stringuniq) |return uniq size |
164
165
  |[TbpgrUtils String#winpath_to_cygwinpath](#stringwinpath_to_cygwinpath) |convert windows path to cygwin path |
165
166
  |[TbpgrUtils Symbol#is_meta_variable?](#symbolis_meta_variable) |is meta variable. |
166
167
  |[Templatable module](#templatable) |get result from template + placeholder |
@@ -3508,6 +3509,16 @@ require 'tbpgr_utils'
3508
3509
 
3509
3510
  [back to list](#list)
3510
3511
 
3512
+ ### String#uniq_size
3513
+ ~~~ruby
3514
+ require 'tbpgr_utils'
3515
+ 'abcdefa'.uniq_size # => 6
3516
+ 'abcdef'.uniq_size # => 6
3517
+ ''.uniq_size # => 0
3518
+ ~~~
3519
+
3520
+ [back to list](#list)
3521
+
3511
3522
  ### String#winpath_to_cygwinpath
3512
3523
  ~~~ruby
3513
3524
  require 'tbpgr_utils'
@@ -3626,6 +3637,7 @@ if you are Sublime Text2 user, you can use snippet for TbpgrUtils.
3626
3637
  https://github.com/tbpgr/tbpgr_utils_snippets
3627
3638
 
3628
3639
  ## History
3640
+ * version 0.0.127 : add String#uniq_size
3629
3641
  * version 0.0.126 : add Array#uniq_size
3630
3642
  * version 0.0.125 : add Hash#>>
3631
3643
  * version 0.0.124 : change spec of Array#>>, String#>>
@@ -0,0 +1,16 @@
1
+ # encoding: utf-8
2
+
3
+ # String
4
+ class String
5
+ # return uniq size
6
+ #
7
+ # === Example
8
+ #
9
+ # 'abcdefa'.uniq_size # => 6
10
+ # 'abcdef'.uniq_size # => 6
11
+ # ''.uniq_size # => 0
12
+ #
13
+ def uniq_size
14
+ split('').uniq.size
15
+ end
16
+ end
@@ -24,4 +24,5 @@ require 'open_classes/string/to_tab_heading'
24
24
  require 'open_classes/string/unescape_double_quote'
25
25
  require 'open_classes/string/unescape_quote'
26
26
  require 'open_classes/string/uniq'
27
+ require 'open_classes/string/uniq_size'
27
28
  require 'open_classes/string/winpath_to_cygwinpath'
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Tbpgr Utilities
4
4
  module TbpgrUtils
5
- VERSION = '0.0.126'
5
+ VERSION = '0.0.127'
6
6
  end
@@ -0,0 +1,54 @@
1
+ # encoding: utf-8
2
+ require 'spec_helper'
3
+ require 'tbpgr_utils'
4
+
5
+ describe String do
6
+ context :uniq_size do
7
+ cases = [
8
+ {
9
+ case_no: 1,
10
+ case_title: 'normal case',
11
+ input: 'abcdefa',
12
+ expected: 6,
13
+ },
14
+ {
15
+ case_no: 2,
16
+ case_title: 'not exist duplicate value case',
17
+ input: 'abcdefa',
18
+ expected: 6,
19
+ },
20
+ {
21
+ case_no: 3,
22
+ case_title: 'empty case',
23
+ input: '',
24
+ expected: 0,
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/then --
37
+ actual = c[:input].uniq_size
38
+
39
+ expect(actual).to eq(c[:expected])
40
+ ensure
41
+ case_after c
42
+ end
43
+ end
44
+
45
+ def case_before(c)
46
+ # implement each case before
47
+ end
48
+
49
+ def case_after(c)
50
+ # implement each case after
51
+ end
52
+ end
53
+ end
54
+ 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.126
4
+ version: 0.0.127
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-13 00:00:00.000000000 Z
11
+ date: 2014-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -234,6 +234,7 @@ files:
234
234
  - lib/open_classes/string/unescape_double_quote.rb
235
235
  - lib/open_classes/string/unescape_quote.rb
236
236
  - lib/open_classes/string/uniq.rb
237
+ - lib/open_classes/string/uniq_size.rb
237
238
  - lib/open_classes/string/winpath_to_cygwinpath.rb
238
239
  - lib/open_classes/symbol.rb
239
240
  - lib/open_classes/symbol/is_meta_variable.rb
@@ -366,6 +367,7 @@ files:
366
367
  - spec/open_classes/string/to_tab_heading_spec.rb
367
368
  - spec/open_classes/string/unescape_double_quote_spec.rb
368
369
  - spec/open_classes/string/unescape_quote_spec.rb
370
+ - spec/open_classes/string/uniq_size_spec.rb
369
371
  - spec/open_classes/string/uniq_spec.rb
370
372
  - spec/open_classes/string/winpath_to_cygwinpath_spec.rb
371
373
  - spec/open_classes/symbol/is_meta_variable_spec.rb
@@ -522,6 +524,7 @@ test_files:
522
524
  - spec/open_classes/string/to_tab_heading_spec.rb
523
525
  - spec/open_classes/string/unescape_double_quote_spec.rb
524
526
  - spec/open_classes/string/unescape_quote_spec.rb
527
+ - spec/open_classes/string/uniq_size_spec.rb
525
528
  - spec/open_classes/string/uniq_spec.rb
526
529
  - spec/open_classes/string/winpath_to_cygwinpath_spec.rb
527
530
  - spec/open_classes/symbol/is_meta_variable_spec.rb