royw-roys_extensions 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +1 -1
- data/lib/file_extensions.rb +12 -1
- data/lib/string_extensions.rb +8 -0
- data/spec/string_extensions_spec.rb +4 -0
- metadata +2 -2
data/VERSION.yml
CHANGED
data/lib/file_extensions.rb
CHANGED
@@ -7,7 +7,7 @@ require 'module_extensions'
|
|
7
7
|
class File
|
8
8
|
class << self
|
9
9
|
my_extension("mkdirs") do
|
10
|
-
|
10
|
+
# == Synopsis
|
11
11
|
# make directories including any missing in the path
|
12
12
|
#
|
13
13
|
# @param [String] dirspec the path to make sure exists
|
@@ -18,5 +18,16 @@ class File
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
21
|
+
|
22
|
+
my_extension("touch") do
|
23
|
+
# == Synopsis
|
24
|
+
# Sets the last modification time of the given filespec
|
25
|
+
# to the current time. Create the given file if it doesn't
|
26
|
+
# exist
|
27
|
+
require 'fileutils'
|
28
|
+
def File.touch(filespec)
|
29
|
+
FileUtils.touch(filespec)
|
30
|
+
end
|
31
|
+
end
|
21
32
|
end
|
22
33
|
end
|
data/lib/string_extensions.rb
CHANGED
@@ -24,6 +24,14 @@ class String
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
+
my_extension("remove_punctuation") do
|
28
|
+
# == Synopsis
|
29
|
+
# remove punctuation the shouldn't be in file names
|
30
|
+
def remove_punctuation
|
31
|
+
self.gsub(/([\?\:\!\"\'\,\.\-\/\*\~\;\@\#\$\%\^])/, ' ').gsub(/\s+/, ' ').strip
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
27
35
|
my_extension("strip_tags") do
|
28
36
|
# == Synopsis
|
29
37
|
# remove angle bracket tags from the string
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: royw-roys_extensions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roy Wright
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-04-
|
12
|
+
date: 2009-04-22 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|