wordnik_ruby_helpers 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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- wordnik_ruby_helpers (0.1.4)
4
+ wordnik_ruby_helpers (0.1.5)
5
5
  RedCloth (>= 4.2.3)
6
6
  rails
7
7
 
@@ -11,12 +11,12 @@ GEM
11
11
  RedCloth (4.2.7)
12
12
  ZenTest (4.5.0)
13
13
  abstract (1.0.0)
14
- actionmailer (3.0.7)
15
- actionpack (= 3.0.7)
16
- mail (~> 2.2.15)
17
- actionpack (3.0.7)
18
- activemodel (= 3.0.7)
19
- activesupport (= 3.0.7)
14
+ actionmailer (3.0.9)
15
+ actionpack (= 3.0.9)
16
+ mail (~> 2.2.19)
17
+ actionpack (3.0.9)
18
+ activemodel (= 3.0.9)
19
+ activesupport (= 3.0.9)
20
20
  builder (~> 2.1.2)
21
21
  erubis (~> 2.6.6)
22
22
  i18n (~> 0.5.0)
@@ -24,19 +24,19 @@ GEM
24
24
  rack-mount (~> 0.6.14)
25
25
  rack-test (~> 0.5.7)
26
26
  tzinfo (~> 0.3.23)
27
- activemodel (3.0.7)
28
- activesupport (= 3.0.7)
27
+ activemodel (3.0.9)
28
+ activesupport (= 3.0.9)
29
29
  builder (~> 2.1.2)
30
30
  i18n (~> 0.5.0)
31
- activerecord (3.0.7)
32
- activemodel (= 3.0.7)
33
- activesupport (= 3.0.7)
34
- arel (~> 2.0.2)
31
+ activerecord (3.0.9)
32
+ activemodel (= 3.0.9)
33
+ activesupport (= 3.0.9)
34
+ arel (~> 2.0.10)
35
35
  tzinfo (~> 0.3.23)
36
- activeresource (3.0.7)
37
- activemodel (= 3.0.7)
38
- activesupport (= 3.0.7)
39
- activesupport (3.0.7)
36
+ activeresource (3.0.9)
37
+ activemodel (= 3.0.9)
38
+ activesupport (= 3.0.9)
39
+ activesupport (3.0.9)
40
40
  arel (2.0.10)
41
41
  autotest (4.4.6)
42
42
  ZenTest (>= 4.4.1)
@@ -58,28 +58,30 @@ GEM
58
58
  rack (>= 1.0.0)
59
59
  rack-test (0.5.7)
60
60
  rack (>= 1.0)
61
- rails (3.0.7)
62
- actionmailer (= 3.0.7)
63
- actionpack (= 3.0.7)
64
- activerecord (= 3.0.7)
65
- activeresource (= 3.0.7)
66
- activesupport (= 3.0.7)
61
+ rails (3.0.9)
62
+ actionmailer (= 3.0.9)
63
+ actionpack (= 3.0.9)
64
+ activerecord (= 3.0.9)
65
+ activeresource (= 3.0.9)
66
+ activesupport (= 3.0.9)
67
67
  bundler (~> 1.0)
68
- railties (= 3.0.7)
69
- railties (3.0.7)
70
- actionpack (= 3.0.7)
71
- activesupport (= 3.0.7)
68
+ railties (= 3.0.9)
69
+ railties (3.0.9)
70
+ actionpack (= 3.0.9)
71
+ activesupport (= 3.0.9)
72
72
  rake (>= 0.8.7)
73
+ rdoc (~> 3.4)
73
74
  thor (~> 0.14.4)
74
75
  rake (0.9.2)
75
- rspec (2.5.0)
76
- rspec-core (~> 2.5.0)
77
- rspec-expectations (~> 2.5.0)
78
- rspec-mocks (~> 2.5.0)
79
- rspec-core (2.5.2)
80
- rspec-expectations (2.5.0)
76
+ rdoc (3.8)
77
+ rspec (2.6.0)
78
+ rspec-core (~> 2.6.0)
79
+ rspec-expectations (~> 2.6.0)
80
+ rspec-mocks (~> 2.6.0)
81
+ rspec-core (2.6.4)
82
+ rspec-expectations (2.6.0)
81
83
  diff-lcs (~> 1.1.2)
82
- rspec-mocks (2.5.0)
84
+ rspec-mocks (2.6.0)
83
85
  thor (0.14.6)
84
86
  treetop (1.4.9)
85
87
  polyglot (>= 0.3.1)
@@ -1,3 +1,3 @@
1
1
  module WordnikRubyHelpers
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
@@ -313,4 +313,19 @@ class Array
313
313
  replacement
314
314
  end
315
315
 
316
+ end
317
+
318
+ class Hash
319
+
320
+ def symbolize_and_underscore_keys
321
+ inject({}) do |options, (key, value)|
322
+ options[(key.to_s.underscore.to_sym rescue key) || key] = value
323
+ options
324
+ end
325
+ end
326
+
327
+ def symbolize_and_underscore_keys!
328
+ self.replace(self.symbolize_and_underscore_keys)
329
+ end
330
+
316
331
  end
@@ -89,6 +89,24 @@ describe WordnikRubyHelpers do
89
89
  value_or_default("Arg Matey", "nada").should == "Arg Matey"
90
90
  end
91
91
  end
92
+
93
+ describe "Hash" do
94
+
95
+ it "symbolize_and_underscore_keys" do
96
+ a = {'firstName' => 'Zeke', :lastName => 'Sikelianos'}
97
+ b = a.symbolize_and_underscore_keys
98
+ b.keys.should == [:first_name, :last_name]
99
+ end
100
+
101
+ it "symbolize_and_underscore_keys!" do
102
+ a = {'firstName' => 'Zeke', :lastName => 'Sikelianos'}
103
+ a.symbolize_and_underscore_keys!
104
+ a.keys.should == [:first_name, :last_name]
105
+ end
106
+
107
+
108
+ end
109
+
92
110
 
93
111
 
94
112
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: wordnik_ruby_helpers
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.5
5
+ version: 0.1.6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Zeke Sikelianos
@@ -11,8 +11,7 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2011-07-11 00:00:00 -07:00
15
- default_executable:
14
+ date: 2011-07-22 00:00:00 Z
16
15
  dependencies:
17
16
  - !ruby/object:Gem::Dependency
18
17
  name: rails
@@ -91,7 +90,6 @@ files:
91
90
  - spec/spec_helper.rb
92
91
  - spec/wordnik_ruby_helpers_spec.rb
93
92
  - wordnik_ruby_helpers.gemspec
94
- has_rdoc: true
95
93
  homepage: http://wordnik.com
96
94
  licenses: []
97
95
 
@@ -115,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
115
113
  requirements: []
116
114
 
117
115
  rubyforge_project: wordnik_ruby_helpers
118
- rubygems_version: 1.5.1
116
+ rubygems_version: 1.8.5
119
117
  signing_key:
120
118
  specification_version: 3
121
119
  summary: A handful of monkey patches and view helpers that we use in our rails projects