effective_resources 1.18.8 → 1.18.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/effective/attribute.rb +25 -1
- data/lib/effective_resources/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5cee67d7d1f8986997b77f0a8d4d2f50cd7b0344ec84522dea0980df07662098
|
4
|
+
data.tar.gz: 07bd05a2149368657239d5ed7abd4cce69a3d84b761f81f2653353c3cb4441d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 395ca8155e668c86d1060901f9106f155d8202d0f235aac7ec8ef9e497b45b6b02386ec6e6e127615a3291640514508f2ccdbbc3696a1ff41c050ad83289b10e
|
7
|
+
data.tar.gz: 4d264db3c46fb74607fc31094a435e3b7c6db1895639f7a425ae65b971a0a051e0f09e1ad5ff059c38d3f5f36e243734302205a29fb6a703ac274847578da9e5
|
@@ -124,8 +124,32 @@ module Effective
|
|
124
124
|
value.presence
|
125
125
|
when :price # Integer * 100. Number of cents.
|
126
126
|
value.kind_of?(Integer) ? value : (value.to_s.gsub(/[^0-9|\-|\.]/, '').to_f * 100.0).round
|
127
|
-
when :string
|
127
|
+
when :string
|
128
128
|
value.to_s
|
129
|
+
when :email
|
130
|
+
return nil unless value.kind_of?(String)
|
131
|
+
|
132
|
+
if value.include?('<') && value.include?('>')
|
133
|
+
value = value.match(/<(.+)>/)[1].to_s # John Smith <john.smith@hotmail.com>
|
134
|
+
end
|
135
|
+
|
136
|
+
if value.include?(',')
|
137
|
+
value = value.split(',').find { |str| str.include?('@') }.to_s
|
138
|
+
end
|
139
|
+
|
140
|
+
if value.include?(' ')
|
141
|
+
value = value.split(' ').find { |str| str.include?('@') }.to_s
|
142
|
+
end
|
143
|
+
|
144
|
+
value = value.to_s.downcase.strip
|
145
|
+
|
146
|
+
return nil unless value.include?('@') && value.include?('.')
|
147
|
+
|
148
|
+
if defined?(Devise)
|
149
|
+
return nil unless Devise::email_regexp.match?(value)
|
150
|
+
end
|
151
|
+
|
152
|
+
value
|
129
153
|
when :belongs_to_polymorphic
|
130
154
|
value.to_s
|
131
155
|
when :belongs_to, :has_many, :has_and_belongs_to_many, :has_one, :resource, :effective_addresses # Returns an Array of ints, an Int or String
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_resources
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.18.
|
4
|
+
version: 1.18.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|