extlib_lite 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -11,6 +11,9 @@ Currently extlib_lite supports the following functions
11
11
  * underscore
12
12
  * to_const_path
13
13
 
14
+ ### Hash
15
+ * stringify
16
+
14
17
  ## Installation
15
18
 
16
19
  gem install extlib_lite
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.0.4
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.3"
8
+ s.version = "0.0.4"
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-10-09}
12
+ s.date = %q{2010-10-10}
13
13
  s.email = %q{dwilkie@gmail.com}
14
14
  s.extra_rdoc_files = [
15
15
  "README.markdown"
@@ -23,6 +23,7 @@ Gem::Specification.new do |s|
23
23
  "extlib_lite.gemspec",
24
24
  "lib/extlib_lite.rb",
25
25
  "lib/extlib_lite/core_extensions.rb",
26
+ "lib/extlib_lite/core_extensions/hash.rb",
26
27
  "lib/extlib_lite/core_extensions/string.rb",
27
28
  "lib/extlib_lite/inflections.rb",
28
29
  "todo"
@@ -1,4 +1,3 @@
1
- require 'addressable/uri'
2
1
  # Load each available extension
3
2
  Dir["#{File.dirname(__FILE__)}/core_extensions/*.rb"].sort.each do |path|
4
3
  require "extlib_lite/core_extensions/#{File.basename(path)}"
@@ -0,0 +1,30 @@
1
+ class Hash
2
+
3
+ # Convert all keys to strings and deeply converts all values to strings
4
+ # Useful for creating a query string
5
+ #
6
+ # @example
7
+ # {
8
+ # :number => 1
9
+ # :time => {
10
+ # :actual_time => 2010-10-09 11:49:59 UTC
11
+ # }
12
+ # }.stringify #=>
13
+ # {
14
+ # "number" => "1",
15
+ # "time" => {
16
+ # "actual_time" => "2010-10-09 11:49:59 UTC"
17
+ # }
18
+ # }
19
+ #
20
+ def stringify
21
+ stringified_hash = {}
22
+ each do |key, value|
23
+ value.is_a?(Hash) ?
24
+ stringified_hash[key.to_s] = value.stringify :
25
+ stringified_hash[key.to_s] = value.to_s
26
+ end
27
+ stringified_hash
28
+ end
29
+ end
30
+
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 3
9
- version: 0.0.3
8
+ - 4
9
+ version: 0.0.4
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-10-09 00:00:00 +07:00
17
+ date: 2010-10-10 00:00:00 +07:00
18
18
  default_executable:
19
19
  dependencies: []
20
20
 
@@ -35,6 +35,7 @@ files:
35
35
  - extlib_lite.gemspec
36
36
  - lib/extlib_lite.rb
37
37
  - lib/extlib_lite/core_extensions.rb
38
+ - lib/extlib_lite/core_extensions/hash.rb
38
39
  - lib/extlib_lite/core_extensions/string.rb
39
40
  - lib/extlib_lite/inflections.rb
40
41
  - todo