clearbit 0.0.9 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/examples/email.rb +0 -2
- data/lib/clearbit.rb +4 -0
- data/lib/clearbit/mash.rb +20 -1
- data/lib/clearbit/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a3cdccc9a76f5753301844526a4ee0b739e2177
|
4
|
+
data.tar.gz: 28d4b914401787f4aa352c187f7cf72f1049e7d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 805deb5d946a10a2f9e2709c402469a305fffabdb5a3874b78952107906a4521aece70423a80d5aa46c0cbf3e7a5a1f74743f7fb0892f484cb5fc2847bd6c96a
|
7
|
+
data.tar.gz: 44828fc7c16005f06370c079dfde0aceb381a36f8325858f610acfb4c27f28928b687fb6770b74445be79f6a9a7435c8f4f3ffec8e948c782be18d9d40ed6d57
|
data/examples/email.rb
CHANGED
data/lib/clearbit.rb
CHANGED
data/lib/clearbit/mash.rb
CHANGED
@@ -142,7 +142,17 @@ module Clearbit
|
|
142
142
|
|
143
143
|
def method_missing(method_name, *args, &blk)
|
144
144
|
return self.[](method_name, &blk) if key?(method_name)
|
145
|
+
|
146
|
+
underscored_name = underscore(method_name.to_s)
|
147
|
+
|
148
|
+
if key?(underscored_name)
|
149
|
+
warn 'camelCased property names are deprecated. ' + '
|
150
|
+
Please use underscored properties.'
|
151
|
+
return self.[](underscored_name, &blk)
|
152
|
+
end
|
153
|
+
|
145
154
|
match = method_name.to_s.match(/(.*?)([?=!_]?)$/)
|
155
|
+
|
146
156
|
case match[2]
|
147
157
|
when "="
|
148
158
|
self[match[1]] = args.first
|
@@ -159,8 +169,17 @@ module Clearbit
|
|
159
169
|
|
160
170
|
protected
|
161
171
|
|
172
|
+
def underscore(camel_cased_word)
|
173
|
+
word = camel_cased_word.to_s.gsub('::', '/')
|
174
|
+
word.gsub!(/([A-Z\d]+)([A-Z][a-z])/,'\1_\2')
|
175
|
+
word.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
|
176
|
+
word.tr!("-", "_")
|
177
|
+
word.downcase!
|
178
|
+
word
|
179
|
+
end
|
180
|
+
|
162
181
|
def convert_key(key) #:nodoc:
|
163
|
-
key.to_s
|
182
|
+
underscore(key.to_s)
|
164
183
|
end
|
165
184
|
|
166
185
|
def convert_value(val, duping=false) #:nodoc:
|
data/lib/clearbit/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clearbit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex MacCaw
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|