crowd_support 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -0
- data/lib/crowd_support/core_ext/string.rb +18 -0
- data/lib/crowd_support.rb +3 -0
- metadata +48 -0
data/README.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Solutions to common problems from the crowd.
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class String
|
2
|
+
# source: http://stackoverflow.com/a/10823131
|
3
|
+
def sanitize_filename
|
4
|
+
# Split the name when finding a period which is preceded by some
|
5
|
+
# character, and is followed by some character other than a period,
|
6
|
+
# if there is no following period that is followed by something
|
7
|
+
# other than a period (yeah, confusing, I know)
|
8
|
+
fn = dup.split /(?<=.)\.(?=[^.])(?!.*\.[^.])/m
|
9
|
+
|
10
|
+
# We now have one or two parts (depending on whether we could find
|
11
|
+
# a suitable period). For each of these parts, replace any unwanted
|
12
|
+
# sequence of characters with an underscore
|
13
|
+
fn.map! { |s| s.gsub /[^a-z0-9\-]+/i, '_' }
|
14
|
+
|
15
|
+
# Finally, join the parts with a period and return the result
|
16
|
+
return fn.join '.'
|
17
|
+
end
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: crowd_support
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Aaron Breckenridge
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-08-22 00:00:00.000000000Z
|
13
|
+
dependencies: []
|
14
|
+
description: incorporating solutions found on Google, StackExchange, etc. that i've
|
15
|
+
needed to use more than once
|
16
|
+
email: aaronbreckenridge@gmail.com
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- README.md
|
22
|
+
- lib/crowd_support/core_ext/string.rb
|
23
|
+
- lib/crowd_support.rb
|
24
|
+
homepage: http://www.breckenedge.com
|
25
|
+
licenses: []
|
26
|
+
post_install_message:
|
27
|
+
rdoc_options: []
|
28
|
+
require_paths:
|
29
|
+
- lib
|
30
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
31
|
+
none: false
|
32
|
+
requirements:
|
33
|
+
- - ! '>='
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: 1.9.1
|
36
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
37
|
+
none: false
|
38
|
+
requirements:
|
39
|
+
- - ! '>='
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: 1.3.6
|
42
|
+
requirements: []
|
43
|
+
rubyforge_project:
|
44
|
+
rubygems_version: 1.7.2
|
45
|
+
signing_key:
|
46
|
+
specification_version: 3
|
47
|
+
summary: solutions to common problems sourced from the internet
|
48
|
+
test_files: []
|