graph_starter 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/app/models/graph_starter/view.rb +2 -0
- data/lib/graph_starter/ip_address_validator.rb +19 -0
- data/lib/graph_starter/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e3cb6569a3ccc4e443bc052a109ef9e72a6554a
|
4
|
+
data.tar.gz: be29217c2e8783a128fea3f39d5b512d20ab47ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 827296f2a570b1aaee411c9bda8095ea21de1ced12a88c41fa2698bdac5b195eb0dedd210c4558168d28cb277f9a4d1111dc26c3446f8deb9fee77a8b3e544f0
|
7
|
+
data.tar.gz: b955f96ca5b0876e7d611e7f52e73dabd7754f59b74822f3c43df7d8acba1e1e098c14cc25fac0a308b3cf2628e47308ee2226b1640c6cff6e68d4f6a98ee640
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class IpAddressValidator < ActiveModel::EachValidator
|
2
|
+
def validate_each(record, attribute, value)
|
3
|
+
message = validation_message(value)
|
4
|
+
|
5
|
+
record.errors.add attribute, message if message
|
6
|
+
end
|
7
|
+
|
8
|
+
def validation_message(value)
|
9
|
+
match = value.to_s.match(/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/)
|
10
|
+
|
11
|
+
if match
|
12
|
+
if !value.split('.').all? { |segment| segment.to_i.in?(0..255) }
|
13
|
+
'segments must be between 0 and 255'
|
14
|
+
end
|
15
|
+
else
|
16
|
+
'must match IP address pattern'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graph_starter
|
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
|
- Brian Underwood
|
@@ -158,6 +158,7 @@ files:
|
|
158
158
|
- config/routes.rb
|
159
159
|
- lib/graph_starter.rb
|
160
160
|
- lib/graph_starter/engine.rb
|
161
|
+
- lib/graph_starter/ip_address_validator.rb
|
161
162
|
- lib/graph_starter/query_authorizer.rb
|
162
163
|
- lib/graph_starter/version.rb
|
163
164
|
- lib/tasks/graph_starter_tasks.rake
|