ip_address_validator 1.0.1 → 2.0.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: db0a7b1739ea1d25b0acc928c0b5ba6352bb64e13f5338c0ce5906b7a229404a
4
+ data.tar.gz: e5250255f4e377d10c638156aad4b80b1fa5913bc386f764e44ded225c8182da
5
+ SHA512:
6
+ metadata.gz: 9c3e940aaa1d893353a21616e5ea48682dacd029771a24879666ac83bfd3f191a11ab34c21e57583aac7d971f2385f33eb5739b252011316529441ca93f9dc8e
7
+ data.tar.gz: 54952b376c8b9bd6495dbc1b8fd9a80655b015dd72e3742bdfdc014eed7190be2ff0510460006928051db06aad4dfede63048a51eef0062256caeabab62dc030
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --format=documentation
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,12 @@
1
+ inherit_from:
2
+ - ~/.rubocop.yml
3
+ - ~/.rubocop-rspec.yml
4
+
5
+ inherit_mode:
6
+ merge:
7
+ - Include
8
+ - Exclude
9
+ - Environments
10
+
11
+ AllCops:
12
+ NewCops: enable
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ lev
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-4.0.3
data/CHANGELOG.md ADDED
@@ -0,0 +1,44 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## [2.0.0] - 2026-05-14
6
+
7
+ ### Breaking
8
+ - Bumped minimum Ruby to **3.1**.
9
+ - Bumped `activemodel` runtime dependency to **>= 6.1**. `activerecord` is no
10
+ longer a (transitive) dependency; the validator only needs ActiveModel.
11
+ - `localized_each_validator` runtime dependency bumped to **>= 2.0**.
12
+ - CIDR strings (e.g. `"10.0.0.0/24"`) are **no longer accepted by default**.
13
+ In 1.x they silently passed because `IPAddr.new` accepts them, so subnets
14
+ validated as "IP addresses". Pass `allow_cidr: true` to restore the old
15
+ behavior.
16
+ - Non-`String` values are now explicitly rejected.
17
+
18
+ ### Added
19
+ - `:allow_cidr` option (default `false`) — opt back in to CIDR notation.
20
+ - `:no_loopback` option — rejects `127.0.0.0/8` and `::1`.
21
+ - `:no_private` option — rejects RFC 1918 ranges and IPv6 unique local
22
+ (`fc00::/7`).
23
+ - `:no_reserved` option — rejects link-local, multicast, broadcast,
24
+ documentation, benchmarking, TEST-NET and other reserved blocks.
25
+ - `:allow_blank` is now documented (it was already inherited from
26
+ `LocalizedEachValidator`).
27
+ - `IpAddressValidator::VERSION` constant in `lib/ip_address_validator/version.rb`.
28
+ - Real test suite (`spec/ip_address_validator_spec.rb`) — previously zero
29
+ tests shipped with the gem.
30
+
31
+ ### Changed
32
+ - Replaced jeweler-generated gemspec with a hand-written one using
33
+ `git ls-files` and modern `spec.metadata` (including
34
+ `rubygems_mfa_required`).
35
+ - Replaced jeweler-flavored Rakefile with a small RSpec + bundler/gem_tasks
36
+ Rakefile.
37
+ - Modernized README; removed Rails-3-era framing.
38
+ - Added GitHub Actions matrix (Ruby 3.1–3.4 × activemodel 7.0–8.0).
39
+
40
+ ### Removed
41
+ - `jeweler`, `yard`, and `RedCloth`/`redcarpet` dev dependencies.
42
+ - `.travis.yml`.
43
+ - Stale `README.textile` references.
44
+ - The duplicate `add_dependency` lines in the old gemspec.
data/README.md ADDED
@@ -0,0 +1,85 @@
1
+ # ip_address_validator
2
+
3
+ [![CI](https://github.com/RISCfuture/ip_address_validator/actions/workflows/ci.yml/badge.svg)](https://github.com/RISCfuture/ip_address_validator/actions/workflows/ci.yml)
4
+ [![Gem Version](https://img.shields.io/gem/v/ip_address_validator.svg)](https://rubygems.org/gems/ip_address_validator)
5
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
6
+
7
+ A localizable `EachValidator` for IPv4 and IPv6 address fields, with optional
8
+ restrictions on CIDR, loopback, private, and reserved ranges. Works with any
9
+ class that uses `ActiveModel::Validations` (Rails models, plain Ruby objects
10
+ that `include ActiveModel::Validations`, etc.).
11
+
12
+ ## Installation
13
+
14
+ ```ruby
15
+ gem "ip_address_validator", "~> 2.0"
16
+ ```
17
+
18
+ Requires Ruby 3.1 or newer and `activemodel >= 6.1`.
19
+
20
+ ## Usage
21
+
22
+ ```ruby
23
+ class User
24
+ include ActiveModel::Validations
25
+ attr_accessor :last_login_ip
26
+
27
+ validates :last_login_ip, ip_address: true
28
+ end
29
+ ```
30
+
31
+ ### Options
32
+
33
+ | Option | Default | Description |
34
+ |:---------------|:-------:|:-----------------------------------------------------------------------------------------------------------|
35
+ | `:ipv4_only` | `false` | If `true`, IPv6 addresses are considered invalid. |
36
+ | `:ipv6_only` | `false` | If `true`, IPv4 addresses are considered invalid. |
37
+ | `:allow_cidr` | `false` | If `true`, CIDR notation (e.g. `10.0.0.0/24`) is accepted. Otherwise any value containing `/` is rejected. |
38
+ | `:no_loopback` | `false` | If `true`, loopback addresses (`127.0.0.0/8`, `::1`) are rejected. |
39
+ | `:no_private` | `false` | If `true`, RFC 1918 ranges and IPv6 unique local (`fc00::/7`) are rejected. |
40
+ | `:no_reserved` | `false` | If `true`, link-local, multicast, broadcast, documentation, and other reserved blocks are rejected. |
41
+ | `:message` | — | Custom error message. |
42
+ | `:allow_nil` | `false` | If `true`, `nil` values are allowed. |
43
+ | `:allow_blank` | `false` | If `true`, blank values are allowed. |
44
+
45
+ ### Examples
46
+
47
+ ```ruby
48
+ # Only allow public, non-CIDR IPv4 addresses.
49
+ validates :webhook_source_ip, ip_address: {
50
+ ipv4_only: true,
51
+ no_loopback: true,
52
+ no_private: true,
53
+ no_reserved: true
54
+ }
55
+
56
+ # Allow a CIDR block (e.g. for an IP allowlist field).
57
+ validates :allowlist_entry, ip_address: { allow_cidr: true }
58
+
59
+ # Custom message.
60
+ validates :remote_ip, ip_address: { message: "must be a valid IP" }
61
+ ```
62
+
63
+ ### Localization
64
+
65
+ The error key is `invalid_ip`. Define it under the usual ActiveModel
66
+ errors hierarchy:
67
+
68
+ ```yaml
69
+ en:
70
+ activemodel:
71
+ errors:
72
+ messages:
73
+ invalid_ip: "is not a valid IP address"
74
+ ```
75
+
76
+ ## Development
77
+
78
+ ```sh
79
+ bin/setup
80
+ bundle exec rspec
81
+ ```
82
+
83
+ ## License
84
+
85
+ Released under the MIT License. See `LICENSE`.
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
@@ -1,51 +1,47 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
- # -*- encoding: utf-8 -*-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = "ip_address_validator"
8
- s.version = "1.0.1"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Tim Morgan"]
12
- s.date = "2012-03-20"
13
- s.description = "A simple, localizable EachValidator for IPv4 and IPv6 address fields in ActiveRecord 3.0."
14
- s.email = "git@timothymorgan.info"
15
- s.extra_rdoc_files = [
16
- "LICENSE",
17
- "README.textile"
18
- ]
19
- s.files = [
20
- "LICENSE",
21
- "README.textile",
22
- "ip_address_validator.gemspec",
23
- "lib/ip_address_validator.rb"
24
- ]
25
- s.homepage = "http://github.com/riscfuture/ip_address_validator"
26
- s.require_paths = ["lib"]
27
- s.rubygems_version = "1.8.17"
28
- s.summary = "Simple IP address validation in Rails 3"
29
-
30
- if s.respond_to? :specification_version then
31
- s.specification_version = 3
32
-
33
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
34
- s.add_runtime_dependency(%q<localized_each_validator>, [">= 1.0.1"])
35
- s.add_development_dependency(%q<jeweler>, [">= 0"])
36
- s.add_development_dependency(%q<yard>, [">= 0"])
37
- s.add_development_dependency(%q<RedCloth>, [">= 0"])
38
- else
39
- s.add_dependency(%q<localized_each_validator>, [">= 1.0.1"])
40
- s.add_dependency(%q<jeweler>, [">= 0"])
41
- s.add_dependency(%q<yard>, [">= 0"])
42
- s.add_dependency(%q<RedCloth>, [">= 0"])
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/ip_address_validator/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "ip_address_validator"
7
+ spec.version = IpAddressValidatorGem::VERSION
8
+ spec.authors = ["Tim Morgan"]
9
+ spec.email = ["git@timothymorgan.info"]
10
+
11
+ spec.summary = "Simple IP address validator for ActiveModel"
12
+ spec.description = "A localizable EachValidator for IPv4 and IPv6 address fields, with optional " \
13
+ "restrictions on CIDR, loopback, private, and reserved ranges."
14
+ spec.homepage = "https://github.com/RISCfuture/ip_address_validator"
15
+ spec.license = "MIT"
16
+
17
+ spec.required_ruby_version = ">= 3.1"
18
+
19
+ spec.metadata = {
20
+ "source_code_uri" => "https://github.com/RISCfuture/ip_address_validator",
21
+ "changelog_uri" => "https://github.com/RISCfuture/ip_address_validator/blob/master/CHANGELOG.md",
22
+ "bug_tracker_uri" => "https://github.com/RISCfuture/ip_address_validator/issues",
23
+ "rubygems_mfa_required" => "true"
24
+ }
25
+
26
+ spec.files = Dir.chdir(__dir__) do
27
+ tracked =
28
+ begin
29
+ `git ls-files -z`.split("\x0")
30
+ rescue StandardError
31
+ []
32
+ end
33
+ candidates = tracked.empty? ? Dir["**/*"] : tracked
34
+ candidates.select { |f| File.file?(f) }.reject do |f|
35
+ (File.expand_path(f) == __FILE__) ||
36
+ f.start_with?(*%w[bin/ test/ spec/ features/ .git .github .idea Gemfile])
43
37
  end
44
- else
45
- s.add_dependency(%q<localized_each_validator>, [">= 1.0.1"])
46
- s.add_dependency(%q<jeweler>, [">= 0"])
47
- s.add_dependency(%q<yard>, [">= 0"])
48
- s.add_dependency(%q<RedCloth>, [">= 0"])
49
38
  end
50
- end
39
+ spec.require_paths = ["lib"]
51
40
 
41
+ spec.add_dependency "activemodel", ">= 6.1"
42
+ spec.add_dependency "localized_each_validator", ">= 2.0"
43
+
44
+ spec.add_development_dependency "rake", "~> 13.0"
45
+ spec.add_development_dependency "rspec", "~> 3.0"
46
+ spec.add_development_dependency "standard", ">= 1.0"
47
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Bare version constant. Lives in its own module so this file can be required
4
+ # from the gemspec without pulling in the rest of the gem (or its runtime
5
+ # dependencies). `lib/ip_address_validator.rb` re-exposes this as
6
+ # `IpAddressValidator::VERSION` once the validator class is defined.
7
+ module IpAddressValidatorGem
8
+ VERSION = "2.0.0"
9
+ end
@@ -1,33 +1,110 @@
1
- require 'localized_each_validator'
2
- require 'ipaddr'
1
+ # frozen_string_literal: true
3
2
 
4
- # Validates IPv4 and IPv6 addresses. Uses the @invalid_ip@ error message key.
3
+ require "ipaddr"
4
+ require "localized_each_validator"
5
+
6
+ require_relative "ip_address_validator/version"
7
+
8
+ # `IpAddressValidator` is defined here (not in `version.rb`) because its
9
+ # superclass `LocalizedEachValidator` isn't loaded until this file runs.
10
+
11
+ # Validates IPv4 and IPv6 addresses. Uses the `invalid_ip` error message key.
5
12
  #
6
13
  # @example
7
14
  # validates :last_login_ip, ip_address: true
8
15
  #
9
- # h2. Options
16
+ # Options
17
+ # -------
10
18
  #
11
- # | @:ipv4_only@ | If @true@, IPv6 addresses are considered invalid. |
12
- # | @:ipv6_only@ | If @true@, IPv4 addresses are considered invalid. |
13
- # | @:message@ | A custom message to use if the IP is invalid. |
14
- # | @:allow_nil@ | If true, @nil@ values are allowed. |
19
+ # | | |
20
+ # |:----------------|:-------------------------------------------------------------|
21
+ # | `:ipv4_only` | If `true`, IPv6 addresses are considered invalid. |
22
+ # | `:ipv6_only` | If `true`, IPv4 addresses are considered invalid. |
23
+ # | `:allow_cidr` | If `true`, CIDR notation (e.g. `10.0.0.0/24`) is allowed. |
24
+ # | | Defaults to `false`, so values containing `/` are rejected. |
25
+ # | `:no_loopback` | If `true`, loopback addresses (e.g. `127.0.0.1`, `::1`) |
26
+ # | | are considered invalid. |
27
+ # | `:no_private` | If `true`, RFC 1918 / unique local addresses (e.g. |
28
+ # | | `10.0.0.0/8`, `fc00::/7`) are considered invalid. |
29
+ # | `:no_reserved` | If `true`, reserved addresses (link-local, multicast, |
30
+ # | | unspecified, etc.) are considered invalid. |
31
+ # | `:message` | A custom message to use if the IP is invalid. |
32
+ # | `:allow_nil` | If `true`, `nil` values are allowed. |
33
+ # | `:allow_blank` | If `true`, blank values are allowed. |
15
34
 
16
35
  class IpAddressValidator < LocalizedEachValidator
36
+ VERSION = IpAddressValidatorGem::VERSION
37
+
17
38
  error_key :invalid_ip
18
39
 
19
40
  # @private
20
- def valid?(_, _, value)
21
- ip = nil
22
- begin
23
- ip = IPAddr.new(value)
24
- rescue ArgumentError
25
- return false
41
+ def valid?(_record, _attribute, value)
42
+ return false unless value.is_a?(String)
43
+ return false if !options[:allow_cidr] && value.include?("/")
44
+
45
+ ip =
46
+ begin
47
+ IPAddr.new(value)
48
+ rescue IPAddr::Error, ArgumentError
49
+ return false
50
+ end
51
+
52
+ return false if ip.ipv4? && options[:ipv6_only]
53
+ return false if ip.ipv6? && options[:ipv4_only]
54
+
55
+ return false if options[:no_loopback] && ip.loopback?
56
+ return false if options[:no_private] && private_ip?(ip)
57
+ return false if options[:no_reserved] && reserved_ip?(ip)
58
+
59
+ true
60
+ end
61
+
62
+ private
63
+
64
+ def private_ip?(ip)
65
+ return true if ip.respond_to?(:private?) && ip.private?
66
+
67
+ # Fallback for older Ruby versions: cover RFC 1918 + unique local IPv6.
68
+ if ip.ipv4?
69
+ %w[10.0.0.0/8 172.16.0.0/12 192.168.0.0/16].any? { |r| IPAddr.new(r).include?(ip) }
70
+ elsif ip.ipv6?
71
+ IPAddr.new("fc00::/7").include?(ip)
72
+ else
73
+ false
74
+ end
75
+ end
76
+
77
+ def reserved_ip?(ip)
78
+ return true if ip.link_local?
79
+ return true if ip.respond_to?(:multicast?) ? ip.multicast? : false
80
+ return true if ip.to_s == "0.0.0.0" || ip.to_s == "::"
81
+
82
+ if ip.ipv4?
83
+ reserved_v4 = %w[
84
+ 0.0.0.0/8
85
+ 100.64.0.0/10
86
+ 169.254.0.0/16
87
+ 192.0.0.0/24
88
+ 192.0.2.0/24
89
+ 198.18.0.0/15
90
+ 198.51.100.0/24
91
+ 203.0.113.0/24
92
+ 224.0.0.0/4
93
+ 240.0.0.0/4
94
+ 255.255.255.255/32
95
+ ]
96
+ reserved_v4.any? { |r| IPAddr.new(r).include?(ip) }
97
+ elsif ip.ipv6?
98
+ reserved_v6 = %w[
99
+ ::/128
100
+ ::1/128
101
+ ff00::/8
102
+ 2001:db8::/32
103
+ 100::/64
104
+ ]
105
+ reserved_v6.any? { |r| IPAddr.new(r).include?(ip) }
106
+ else
107
+ false
26
108
  end
27
-
28
- return false if ip.ipv4? and options[:ipv6_only]
29
- return false if ip.ipv6? and options[:ipv4_only]
30
-
31
- return true
32
109
  end
33
110
  end
metadata CHANGED
@@ -1,98 +1,127 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ip_address_validator
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
5
- prerelease:
4
+ version: 2.0.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Tim Morgan
9
- autorequire:
10
8
  bindir: bin
11
9
  cert_chain: []
12
- date: 2012-03-20 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
13
11
  dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: activemodel
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '6.1'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: '6.1'
14
26
  - !ruby/object:Gem::Dependency
15
27
  name: localized_each_validator
16
- requirement: &70167736537100 !ruby/object:Gem::Requirement
17
- none: false
28
+ requirement: !ruby/object:Gem::Requirement
18
29
  requirements:
19
- - - ! '>='
30
+ - - ">="
20
31
  - !ruby/object:Gem::Version
21
- version: 1.0.1
32
+ version: '2.0'
22
33
  type: :runtime
23
34
  prerelease: false
24
- version_requirements: *70167736537100
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '2.0'
25
40
  - !ruby/object:Gem::Dependency
26
- name: jeweler
27
- requirement: &70167736536520 !ruby/object:Gem::Requirement
28
- none: false
41
+ name: rake
42
+ requirement: !ruby/object:Gem::Requirement
29
43
  requirements:
30
- - - ! '>='
44
+ - - "~>"
31
45
  - !ruby/object:Gem::Version
32
- version: '0'
46
+ version: '13.0'
33
47
  type: :development
34
48
  prerelease: false
35
- version_requirements: *70167736536520
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '13.0'
36
54
  - !ruby/object:Gem::Dependency
37
- name: yard
38
- requirement: &70167736535900 !ruby/object:Gem::Requirement
39
- none: false
55
+ name: rspec
56
+ requirement: !ruby/object:Gem::Requirement
40
57
  requirements:
41
- - - ! '>='
58
+ - - "~>"
42
59
  - !ruby/object:Gem::Version
43
- version: '0'
60
+ version: '3.0'
44
61
  type: :development
45
62
  prerelease: false
46
- version_requirements: *70167736535900
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '3.0'
47
68
  - !ruby/object:Gem::Dependency
48
- name: RedCloth
49
- requirement: &70167736535380 !ruby/object:Gem::Requirement
50
- none: false
69
+ name: standard
70
+ requirement: !ruby/object:Gem::Requirement
51
71
  requirements:
52
- - - ! '>='
72
+ - - ">="
53
73
  - !ruby/object:Gem::Version
54
- version: '0'
74
+ version: '1.0'
55
75
  type: :development
56
76
  prerelease: false
57
- version_requirements: *70167736535380
58
- description: A simple, localizable EachValidator for IPv4 and IPv6 address fields
59
- in ActiveRecord 3.0.
60
- email: git@timothymorgan.info
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '1.0'
82
+ description: A localizable EachValidator for IPv4 and IPv6 address fields, with optional
83
+ restrictions on CIDR, loopback, private, and reserved ranges.
84
+ email:
85
+ - git@timothymorgan.info
61
86
  executables: []
62
87
  extensions: []
63
- extra_rdoc_files:
64
- - LICENSE
65
- - README.textile
88
+ extra_rdoc_files: []
66
89
  files:
90
+ - ".document"
91
+ - ".rspec"
92
+ - ".rubocop.yml"
93
+ - ".ruby-gemset"
94
+ - ".ruby-version"
95
+ - CHANGELOG.md
67
96
  - LICENSE
68
- - README.textile
97
+ - README.md
98
+ - Rakefile
69
99
  - ip_address_validator.gemspec
70
100
  - lib/ip_address_validator.rb
71
- homepage: http://github.com/riscfuture/ip_address_validator
72
- licenses: []
73
- post_install_message:
101
+ - lib/ip_address_validator/version.rb
102
+ homepage: https://github.com/RISCfuture/ip_address_validator
103
+ licenses:
104
+ - MIT
105
+ metadata:
106
+ source_code_uri: https://github.com/RISCfuture/ip_address_validator
107
+ changelog_uri: https://github.com/RISCfuture/ip_address_validator/blob/master/CHANGELOG.md
108
+ bug_tracker_uri: https://github.com/RISCfuture/ip_address_validator/issues
109
+ rubygems_mfa_required: 'true'
74
110
  rdoc_options: []
75
111
  require_paths:
76
112
  - lib
77
113
  required_ruby_version: !ruby/object:Gem::Requirement
78
- none: false
79
114
  requirements:
80
- - - ! '>='
115
+ - - ">="
81
116
  - !ruby/object:Gem::Version
82
- version: '0'
83
- segments:
84
- - 0
85
- hash: -1752075545823890085
117
+ version: '3.1'
86
118
  required_rubygems_version: !ruby/object:Gem::Requirement
87
- none: false
88
119
  requirements:
89
- - - ! '>='
120
+ - - ">="
90
121
  - !ruby/object:Gem::Version
91
122
  version: '0'
92
123
  requirements: []
93
- rubyforge_project:
94
- rubygems_version: 1.8.17
95
- signing_key:
96
- specification_version: 3
97
- summary: Simple IP address validation in Rails 3
124
+ rubygems_version: 4.0.11
125
+ specification_version: 4
126
+ summary: Simple IP address validator for ActiveModel
98
127
  test_files: []
data/README.textile DELETED
@@ -1,40 +0,0 @@
1
- h1. ip_address_validator -- Simple IP validator for Rails 3
2
-
3
- | *Author* | Tim Morgan |
4
- | *Version* | 1.0.1 (Mar 19, 2012) |
5
- | *License* | Released under the MIT license. |
6
-
7
- h2. About
8
-
9
- This gem adds a very simple IP address format validator to be used with
10
- ActiveRecord models in Rails 3.0. It supports localized error messages.
11
-
12
- h2. Installation
13
-
14
- Add the gem to your project's @Gemfile@:
15
-
16
- <pre><code>
17
- gem 'ip_address_validator'
18
- </code></pre>
19
-
20
- h2. Usage
21
-
22
- This gem is an @EachValidator@, and thus is used with the @validates@ method:
23
-
24
- <pre><code>
25
- class User < ActiveRecord::Base
26
- validates :last_login_ip,
27
- ip_address: true
28
- end
29
- </code></pre>
30
-
31
- The localization key is @invalid_ip@, and can be specified in the localized
32
- YAML file like so:
33
-
34
- <pre><code>
35
- en:
36
- activerecord:
37
- errors:
38
- messages:
39
- invalid_ip: IP address is invalid.
40
- </code></pre>