tbpgr_utils 0.0.101 → 0.0.102
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -119,6 +119,7 @@ Or install it yourself as:
|
|
119
119
|
|[TbpgrUtils String#ascii_unicode_html_table](#stringascii_unicode_html_table) |get ascii_unicode_html_table |
|
120
120
|
|[TbpgrUtils String#ascii_unicode_table](#stringascii_unicode_table) |get ascii_unicode_table |
|
121
121
|
|[TbpgrUtils String#comma_to_a](#stringcomma_to_a) |comma-format string to array |
|
122
|
+
|[TbpgrUtils String#cygwinpath_to_winpath](#stringcygwinpath_to_winpath) |convert cygwin path to windows path |
|
122
123
|
|[TbpgrUtils String#escape_quote](#stringescape_quote) |escape quote |
|
123
124
|
|[TbpgrUtils String#escape_double_quote](#stringescape_double_quote) |escape double quote |
|
124
125
|
|[TbpgrUtils String#hyphen_to_a](#stringhyphen_to_a) |hyphen-format string to array |
|
@@ -2827,6 +2828,14 @@ require 'tbpgr_utils'
|
|
2827
2828
|
|
2828
2829
|
[back to list](#list)
|
2829
2830
|
|
2831
|
+
### String#cygwinpath_to_winpath
|
2832
|
+
~~~ruby
|
2833
|
+
require 'tbpgr_utils'
|
2834
|
+
'/cygdrive/c/hoge/hoge.txt'.cygwinpath_to_winpath # => 'C:\hoge\hoge.txt'
|
2835
|
+
~~~
|
2836
|
+
|
2837
|
+
[back to list](#list)
|
2838
|
+
|
2830
2839
|
### String#escape_quote
|
2831
2840
|
~~~ruby
|
2832
2841
|
require 'tbpgr_utils'
|
@@ -3273,6 +3282,7 @@ if you are Sublime Text2 user, you can use snippet for TbpgrUtils.
|
|
3273
3282
|
https://github.com/tbpgr/tbpgr_utils_snippets
|
3274
3283
|
|
3275
3284
|
## History
|
3285
|
+
* version 0.0.102 : add String#cygwinpath_to_winpath
|
3276
3286
|
* version 0.0.101 : add String#winpath_to_cygwinpath
|
3277
3287
|
* version 0.0.100 : add String#ascii_unicode_html_table
|
3278
3288
|
* version 0.0.99 : add Numeric.to_oct_html_table
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
class String
|
4
|
+
# convert windows path to cygwin path
|
5
|
+
#
|
6
|
+
# ==== Examples
|
7
|
+
#
|
8
|
+
# '/cygdrive/c/hoge/hoge.txt'.cygwinpath_to_winpath # => 'C:\hoge\hoge.txt'
|
9
|
+
#
|
10
|
+
def cygwinpath_to_winpath
|
11
|
+
return self unless match(/\/cygdrive\//)
|
12
|
+
drive = scan(/\/cygdrive\/(\w)\//).first.first.upcase
|
13
|
+
dir_file = scan(/\/cygdrive\/\w\/(.*)/).first.first.gsub('/', '\\')
|
14
|
+
"#{drive}:\\#{dir_file}"
|
15
|
+
end
|
16
|
+
end
|
data/lib/open_classes/string.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require 'open_classes/string/ascii1_other2_size'
|
3
|
-
require 'open_classes/string/ascii_unicode_table'
|
4
3
|
require 'open_classes/string/ascii_unicode_html_table'
|
4
|
+
require 'open_classes/string/ascii_unicode_table'
|
5
5
|
require 'open_classes/string/comma_to_a'
|
6
|
+
require 'open_classes/string/cygwinpath_to_winpath'
|
6
7
|
require 'open_classes/string/escape_double_quote'
|
7
8
|
require 'open_classes/string/escape_quote'
|
8
9
|
require 'open_classes/string/hyphen_to_a'
|
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/cygwinpath_to_winpath'
|
4
|
+
|
5
|
+
describe String do
|
6
|
+
context :cygwinpath_to_winpath do
|
7
|
+
cases = [
|
8
|
+
{
|
9
|
+
case_no: 1,
|
10
|
+
case_title: 'file case',
|
11
|
+
input: '/cygdrive/c/hoge/hoge.txt',
|
12
|
+
expected: 'C:\hoge\hoge.txt',
|
13
|
+
},
|
14
|
+
{
|
15
|
+
case_no: 2,
|
16
|
+
case_title: 'dir case',
|
17
|
+
input: '/cygdrive/d/hoge',
|
18
|
+
expected: 'D:\hoge',
|
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].cygwinpath_to_winpath
|
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.102
|
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-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
16
|
-
requirement: &
|
16
|
+
requirement: &21059076 !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: *21059076
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: bundler
|
27
|
-
requirement: &
|
27
|
+
requirement: &21057996 !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: *21057996
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rake
|
38
|
-
requirement: &
|
38
|
+
requirement: &21073368 !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: *21073368
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rspec
|
49
|
-
requirement: &
|
49
|
+
requirement: &21072288 !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: *21072288
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: simplecov
|
60
|
-
requirement: &
|
60
|
+
requirement: &21071328 !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: *21071328
|
69
69
|
description: Utilities
|
70
70
|
email:
|
71
71
|
- tbpgr@tbpgr.jp
|
@@ -179,6 +179,7 @@ files:
|
|
179
179
|
- lib/open_classes/string/ascii_unicode_html_table.rb
|
180
180
|
- lib/open_classes/string/ascii_unicode_table.rb
|
181
181
|
- lib/open_classes/string/comma_to_a.rb
|
182
|
+
- lib/open_classes/string/cygwinpath_to_winpath.rb
|
182
183
|
- lib/open_classes/string/escape_double_quote.rb
|
183
184
|
- lib/open_classes/string/escape_quote.rb
|
184
185
|
- lib/open_classes/string/heading_helper.rb
|
@@ -292,6 +293,7 @@ files:
|
|
292
293
|
- spec/open_classes/string/ascii_unicode_html_table_spec.rb
|
293
294
|
- spec/open_classes/string/ascii_unicode_table_spec.rb
|
294
295
|
- spec/open_classes/string/comma_to_a_spec.rb
|
296
|
+
- spec/open_classes/string/cygwinpath_to_winpath_spec.rb
|
295
297
|
- spec/open_classes/string/escape_double_quote_spec.rb
|
296
298
|
- spec/open_classes/string/escape_quote_spec.rb
|
297
299
|
- spec/open_classes/string/hyphen_to_a_spec.rb
|
@@ -428,6 +430,7 @@ test_files:
|
|
428
430
|
- spec/open_classes/string/ascii_unicode_html_table_spec.rb
|
429
431
|
- spec/open_classes/string/ascii_unicode_table_spec.rb
|
430
432
|
- spec/open_classes/string/comma_to_a_spec.rb
|
433
|
+
- spec/open_classes/string/cygwinpath_to_winpath_spec.rb
|
431
434
|
- spec/open_classes/string/escape_double_quote_spec.rb
|
432
435
|
- spec/open_classes/string/escape_quote_spec.rb
|
433
436
|
- spec/open_classes/string/hyphen_to_a_spec.rb
|