clutil 2010.141.1 → 2010.330.0
Sign up to get free protection for your applications and to get access to all the features.
- data/cl/util/string.rb +9 -1
- data/cl/util/test/stringtest.rb +8 -0
- metadata +4 -4
data/cl/util/string.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# $Id: string.rb,v 1.2 2003/06/27 17:46:03 chrismo Exp $
|
2
2
|
=begin
|
3
3
|
----------------------------------------------------------------------------
|
4
|
-
Copyright (c) 2001 -
|
4
|
+
Copyright (c) 2001 - 2010, Chris Morris
|
5
5
|
All rights reserved.
|
6
6
|
|
7
7
|
Redistribution and use in source and binary forms, with or without
|
@@ -37,6 +37,14 @@ class String
|
|
37
37
|
def get_indent
|
38
38
|
scan(/^(\s*)/).flatten[0].to_s
|
39
39
|
end
|
40
|
+
|
41
|
+
def rbpath
|
42
|
+
self.gsub(/\\/, '/')
|
43
|
+
end
|
44
|
+
|
45
|
+
def winpath
|
46
|
+
self.gsub(/\//, "\\")
|
47
|
+
end
|
40
48
|
end
|
41
49
|
|
42
50
|
def indent(s, amt)
|
data/cl/util/test/stringtest.rb
CHANGED
@@ -47,4 +47,12 @@ the indention.
|
|
47
47
|
s = indent(s, -3)
|
48
48
|
assert_equal("hey\nhey\n\n", s)
|
49
49
|
end
|
50
|
+
|
51
|
+
def test_rbpath
|
52
|
+
assert_equal('c:/temp/dir', "c:\\temp\\dir".rbpath)
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_winpath
|
56
|
+
assert_equal('c:\\temp\\dir', "c:/temp/dir".winpath)
|
57
|
+
end
|
50
58
|
end
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 2010
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 2010.
|
7
|
+
- 330
|
8
|
+
- 0
|
9
|
+
version: 2010.330.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- chrismo
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-11-26 00:00:00 -06:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|