wordnik_ruby_helpers 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 +36 -34
- data/lib/wordnik_ruby_helpers/version.rb +1 -1
- data/lib/wordnik_ruby_helpers.rb +15 -0
- data/spec/wordnik_ruby_helpers_spec.rb +18 -0
- metadata +3 -5
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
wordnik_ruby_helpers (0.1.
|
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.
|
15
|
-
actionpack (= 3.0.
|
16
|
-
mail (~> 2.2.
|
17
|
-
actionpack (3.0.
|
18
|
-
activemodel (= 3.0.
|
19
|
-
activesupport (= 3.0.
|
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.
|
28
|
-
activesupport (= 3.0.
|
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.
|
32
|
-
activemodel (= 3.0.
|
33
|
-
activesupport (= 3.0.
|
34
|
-
arel (~> 2.0.
|
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.
|
37
|
-
activemodel (= 3.0.
|
38
|
-
activesupport (= 3.0.
|
39
|
-
activesupport (3.0.
|
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.
|
62
|
-
actionmailer (= 3.0.
|
63
|
-
actionpack (= 3.0.
|
64
|
-
activerecord (= 3.0.
|
65
|
-
activeresource (= 3.0.
|
66
|
-
activesupport (= 3.0.
|
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.
|
69
|
-
railties (3.0.
|
70
|
-
actionpack (= 3.0.
|
71
|
-
activesupport (= 3.0.
|
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
|
-
|
76
|
-
|
77
|
-
rspec-
|
78
|
-
rspec-
|
79
|
-
|
80
|
-
rspec-
|
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.
|
84
|
+
rspec-mocks (2.6.0)
|
83
85
|
thor (0.14.6)
|
84
86
|
treetop (1.4.9)
|
85
87
|
polyglot (>= 0.3.1)
|
data/lib/wordnik_ruby_helpers.rb
CHANGED
@@ -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
|
+
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-
|
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
|
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
|