synchronized_model 0.2.0 → 0.2.1
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/synchronized_model/support.rb +15 -1
- data/lib/synchronized_model/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: 8e0650e391a34a311c43ce5d5a893cca5d733159
|
4
|
+
data.tar.gz: 49166070dc06eb3930132c21836c1b093d3a495f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0581c14dd604efc3a653840b200efa747965d7f90bdcee20e4d6909836cceea03c14d6a9a2553da93ea920ed7abe0eea934d60ab10af7b43a86e45af095032a1'
|
7
|
+
data.tar.gz: abb286e78958d3454a0eab030da9e77cff0b1213640538d197e9970a9cfda87ac05403e164e4684c46c7b961a237acff7563500e05bad216e06b47592c1f1552
|
data/Gemfile.lock
CHANGED
@@ -3,7 +3,9 @@ module SynchronizedModel
|
|
3
3
|
module Support
|
4
4
|
# Taken from ActiveSupport:Inflector.underscore
|
5
5
|
def underscore(camel_cased_word)
|
6
|
-
|
6
|
+
unless matches(/[A-Z-]|::/, camel_cased_word)
|
7
|
+
return camel_cased_word
|
8
|
+
end
|
7
9
|
word = camel_cased_word.to_s.gsub('::', '/')
|
8
10
|
word.gsub!(/([A-Z\d]+)([A-Z][a-z])/, '\1_\2')
|
9
11
|
word.gsub!(/([a-z\d])([A-Z])/, '\1_\2')
|
@@ -11,5 +13,17 @@ module SynchronizedModel
|
|
11
13
|
word.downcase!
|
12
14
|
word
|
13
15
|
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
# `match?` was added in Ruby 2.4 this allows us to be backwards
|
20
|
+
# compatible with older Ruby versions
|
21
|
+
def matches(regexp, word)
|
22
|
+
if regexp.respond_to?(:match?)
|
23
|
+
regexp.match?(word)
|
24
|
+
else
|
25
|
+
regexp.match(word)
|
26
|
+
end
|
27
|
+
end
|
14
28
|
end
|
15
29
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: synchronized_model
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Cranston
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-06-
|
11
|
+
date: 2018-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|