footing 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -5,7 +5,7 @@ GEM
5
5
  coderay (1.0.8)
6
6
  method_source (0.8.1)
7
7
  micro_mock (0.1.1)
8
- micro_test (0.3.1)
8
+ micro_test (0.3.2)
9
9
  os
10
10
  os (0.9.6)
11
11
  pry (0.9.10)
@@ -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/)
@@ -1,3 +1,3 @@
1
1
  module Footing
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
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 test"
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.5
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-03 00:00:00.000000000 Z
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