footing 0.1.5 → 0.1.6
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.
- data/Gemfile.lock +1 -1
- data/lib/footing/extensions/string.rb +6 -1
- data/lib/footing/version.rb +1 -1
- data/test/string_test.rb +6 -1
- metadata +2 -2
data/Gemfile.lock
CHANGED
@@ -37,10 +37,15 @@ module Footing
|
|
37
37
|
|
38
38
|
# Similar to humanize but it capitalizes each word
|
39
39
|
def titleize
|
40
|
-
self.split('_').map(&:capitalize).join(' ')
|
40
|
+
self.gsub(/\s/, "_").split('_').map(&:capitalize).join(' ')
|
41
41
|
end
|
42
42
|
alias :titlecase :titleize
|
43
43
|
|
44
|
+
|
45
|
+
def classify
|
46
|
+
self.gsub(/\s/, "_").titleize.gsub(/\W/, "")
|
47
|
+
end
|
48
|
+
|
44
49
|
# Indicates if this string represents a number.
|
45
50
|
def numeric?
|
46
51
|
!!(self =~ /\A[0-9]+\.*[0-9]*\z/)
|
data/lib/footing/version.rb
CHANGED
data/test/string_test.rb
CHANGED
@@ -42,7 +42,12 @@ class StringTest < MicroTest::Test
|
|
42
42
|
end
|
43
43
|
|
44
44
|
test ".titleize" do
|
45
|
-
assert "foobar test".titleize == "Foobar
|
45
|
+
assert "foobar test".titleize == "Foobar Test"
|
46
|
+
end
|
47
|
+
|
48
|
+
test ".classify" do
|
49
|
+
assert "foo_bar_test".classify == "FooBarTest"
|
50
|
+
assert "foo bar test".classify == "FooBarTest"
|
46
51
|
end
|
47
52
|
|
48
53
|
test ".humanize" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: footing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-12-
|
12
|
+
date: 2012-12-13 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: ! ' Footing is a utillity belt library that employs sane monkey patching.
|
15
15
|
|