extlib_lite 0.0.2 → 0.0.3

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/README.markdown CHANGED
@@ -9,6 +9,7 @@ Currently extlib_lite supports the following functions
9
9
  * classify
10
10
  * constantize
11
11
  * underscore
12
+ * to_const_path
12
13
 
13
14
  ## Installation
14
15
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.2
1
+ 0.0.3
data/extlib_lite.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{extlib_lite}
8
- s.version = "0.0.2"
8
+ s.version = "0.0.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["David Wilkie"]
12
- s.date = %q{2010-09-26}
12
+ s.date = %q{2010-10-09}
13
13
  s.email = %q{dwilkie@gmail.com}
14
14
  s.extra_rdoc_files = [
15
15
  "README.markdown"
@@ -20,5 +20,17 @@ class String
20
20
  def underscore
21
21
  Extlib::Inflection.underscore(self)
22
22
  end
23
+
24
+ def to_const_path
25
+ snake_case.gsub(/::/, "/")
26
+ end
27
+
28
+ private
29
+ def snake_case
30
+ return downcase if match(/\A[A-Z]+\z/)
31
+ gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2').
32
+ gsub(/([a-z])([A-Z])/, '\1_\2').
33
+ downcase
34
+ end
23
35
  end
24
36
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 2
9
- version: 0.0.2
8
+ - 3
9
+ version: 0.0.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - David Wilkie
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-09-26 00:00:00 +07:00
17
+ date: 2010-10-09 00:00:00 +07:00
18
18
  default_executable:
19
19
  dependencies: []
20
20