ip_address_validator 1.0.0 → 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/.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 CHANGED
@@ -1,32 +1,8 @@
1
- require 'rubygems'
2
- require 'bundler'
3
- begin
4
- Bundler.setup(:default, :development)
5
- rescue Bundler::BundlerError => e
6
- $stderr.puts e.message
7
- $stderr.puts "Run `bundle install` to install missing gems"
8
- exit e.status_code
9
- end
10
- require 'rake'
1
+ # frozen_string_literal: true
11
2
 
12
- require 'jeweler'
13
- Jeweler::Tasks.new do |gem|
14
- gem.name = "ip_address_validator"
15
- gem.summary = %Q{Simple IP address validation in Rails 3}
16
- gem.description = %Q{A simple, localizable EachValidator for IPv4 and IPv6 address fields in ActiveRecord 3.0.}
17
- gem.email = "git@timothymorgan.info"
18
- gem.homepage = "http://github.com/riscfuture/ip_address_validator"
19
- gem.authors = [ "Tim Morgan" ]
20
- end
21
- Jeweler::RubygemsDotOrgTasks.new
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
22
5
 
23
- require 'yard'
24
- YARD::Rake::YardocTask.new('doc') do |doc|
25
- doc.options << "-m" << "textile"
26
- doc.options << "--protected"
27
- doc.options << "-r" << "README.textile"
28
- doc.options << "-o" << "doc"
29
- doc.options << "--title" << "ip_address_validator Documentation".inspect
30
-
31
- doc.files = [ 'lib/*.rb', 'README.textile' ]
32
- end
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
@@ -1,56 +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 = %q{ip_address_validator}
8
- s.version = "1.0.0"
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 = %q{2010-12-30}
13
- s.description = %q{A simple, localizable EachValidator for IPv4 and IPv6 address fields in ActiveRecord 3.0.}
14
- s.email = %q{git@timothymorgan.info}
15
- s.extra_rdoc_files = [
16
- "LICENSE",
17
- "README.textile"
18
- ]
19
- s.files = [
20
- ".document",
21
- "Gemfile",
22
- "Gemfile.lock",
23
- "LICENSE",
24
- "README.textile",
25
- "Rakefile",
26
- "VERSION",
27
- "lib/ip_address_validator.rb"
28
- ]
29
- s.homepage = %q{http://github.com/riscfuture/ip_address_validator}
30
- s.require_paths = ["lib"]
31
- s.rubygems_version = %q{1.3.7}
32
- s.summary = %q{Simple IP address validation in Rails 3}
33
-
34
- if s.respond_to? :specification_version then
35
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
36
- s.specification_version = 3
37
-
38
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
39
- s.add_runtime_dependency(%q<localized_each_validator>, [">= 1.0.1"])
40
- s.add_development_dependency(%q<jeweler>, [">= 0"])
41
- s.add_development_dependency(%q<yard>, [">= 0"])
42
- s.add_development_dependency(%q<RedCloth>, [">= 0"])
43
- else
44
- s.add_dependency(%q<localized_each_validator>, [">= 1.0.1"])
45
- s.add_dependency(%q<jeweler>, [">= 0"])
46
- s.add_dependency(%q<yard>, [">= 0"])
47
- 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])
48
37
  end
49
- else
50
- s.add_dependency(%q<localized_each_validator>, [">= 1.0.1"])
51
- s.add_dependency(%q<jeweler>, [">= 0"])
52
- s.add_dependency(%q<yard>, [">= 0"])
53
- s.add_dependency(%q<RedCloth>, [">= 0"])
54
38
  end
55
- end
39
+ spec.require_paths = ["lib"]
56
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,32 +1,110 @@
1
- require 'localized_each_validator'
1
+ # frozen_string_literal: true
2
2
 
3
- # 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.
4
12
  #
5
13
  # @example
6
14
  # validates :last_login_ip, ip_address: true
7
15
  #
8
- # h2. Options
16
+ # Options
17
+ # -------
9
18
  #
10
- # | @:ipv4_only@ | If @true@, IPv6 addresses are considered invalid. |
11
- # | @:ipv6_only@ | If @true@, IPv4 addresses are considered invalid. |
12
- # | @:message@ | A custom message to use if the IP is invalid. |
13
- # | @: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. |
14
34
 
15
35
  class IpAddressValidator < LocalizedEachValidator
36
+ VERSION = IpAddressValidatorGem::VERSION
37
+
16
38
  error_key :invalid_ip
17
39
 
18
40
  # @private
19
- def valid?(_, _, value)
20
- ip = nil
21
- begin
22
- ip = IPAddr.new(value)
23
- rescue ArgumentError
24
- 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
25
108
  end
26
-
27
- return false if ip.ipv4? and options[:ipv6_only]
28
- return false if ip.ipv6? and options[:ipv4_only]
29
-
30
- return true
31
109
  end
32
110
  end
metadata CHANGED
@@ -1,127 +1,127 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: ip_address_validator
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 1
7
- - 0
8
- - 0
9
- version: 1.0.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.0
10
5
  platform: ruby
11
- authors:
6
+ authors:
12
7
  - Tim Morgan
13
- autorequire:
14
8
  bindir: bin
15
9
  cert_chain: []
16
-
17
- date: 2010-12-30 00:00:00 -06:00
18
- default_executable:
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
10
+ date: 1980-01-02 00:00:00.000000000 Z
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'
26
+ - !ruby/object:Gem::Dependency
21
27
  name: localized_each_validator
22
- requirement: &id001 !ruby/object:Gem::Requirement
23
- none: false
24
- requirements:
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
25
30
  - - ">="
26
- - !ruby/object:Gem::Version
27
- segments:
28
- - 1
29
- - 0
30
- - 1
31
- version: 1.0.1
31
+ - !ruby/object:Gem::Version
32
+ version: '2.0'
32
33
  type: :runtime
33
34
  prerelease: false
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: jeweler
37
- requirement: &id002 !ruby/object:Gem::Requirement
38
- none: false
39
- requirements:
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
40
37
  - - ">="
41
- - !ruby/object:Gem::Version
42
- segments:
43
- - 0
44
- version: "0"
38
+ - !ruby/object:Gem::Version
39
+ version: '2.0'
40
+ - !ruby/object:Gem::Dependency
41
+ name: rake
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '13.0'
45
47
  type: :development
46
48
  prerelease: false
47
- version_requirements: *id002
48
- - !ruby/object:Gem::Dependency
49
- name: yard
50
- requirement: &id003 !ruby/object:Gem::Requirement
51
- none: false
52
- requirements:
53
- - - ">="
54
- - !ruby/object:Gem::Version
55
- segments:
56
- - 0
57
- version: "0"
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '13.0'
54
+ - !ruby/object:Gem::Dependency
55
+ name: rspec
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '3.0'
58
61
  type: :development
59
62
  prerelease: false
60
- version_requirements: *id003
61
- - !ruby/object:Gem::Dependency
62
- name: RedCloth
63
- requirement: &id004 !ruby/object:Gem::Requirement
64
- none: false
65
- requirements:
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '3.0'
68
+ - !ruby/object:Gem::Dependency
69
+ name: standard
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
66
72
  - - ">="
67
- - !ruby/object:Gem::Version
68
- segments:
69
- - 0
70
- version: "0"
73
+ - !ruby/object:Gem::Version
74
+ version: '1.0'
71
75
  type: :development
72
76
  prerelease: false
73
- version_requirements: *id004
74
- description: A simple, localizable EachValidator for IPv4 and IPv6 address fields in ActiveRecord 3.0.
75
- 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
76
86
  executables: []
77
-
78
87
  extensions: []
79
-
80
- extra_rdoc_files:
81
- - LICENSE
82
- - README.textile
83
- files:
84
- - .document
85
- - Gemfile
86
- - Gemfile.lock
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".document"
91
+ - ".rspec"
92
+ - ".rubocop.yml"
93
+ - ".ruby-gemset"
94
+ - ".ruby-version"
95
+ - CHANGELOG.md
87
96
  - LICENSE
88
- - README.textile
97
+ - README.md
89
98
  - Rakefile
90
- - VERSION
91
99
  - ip_address_validator.gemspec
92
100
  - lib/ip_address_validator.rb
93
- has_rdoc: true
94
- homepage: http://github.com/riscfuture/ip_address_validator
95
- licenses: []
96
-
97
- 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'
98
110
  rdoc_options: []
99
-
100
- require_paths:
111
+ require_paths:
101
112
  - lib
102
- required_ruby_version: !ruby/object:Gem::Requirement
103
- none: false
104
- requirements:
113
+ required_ruby_version: !ruby/object:Gem::Requirement
114
+ requirements:
105
115
  - - ">="
106
- - !ruby/object:Gem::Version
107
- hash: 1922130186424659959
108
- segments:
109
- - 0
110
- version: "0"
111
- required_rubygems_version: !ruby/object:Gem::Requirement
112
- none: false
113
- requirements:
116
+ - !ruby/object:Gem::Version
117
+ version: '3.1'
118
+ required_rubygems_version: !ruby/object:Gem::Requirement
119
+ requirements:
114
120
  - - ">="
115
- - !ruby/object:Gem::Version
116
- segments:
117
- - 0
118
- version: "0"
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
119
123
  requirements: []
120
-
121
- rubyforge_project:
122
- rubygems_version: 1.3.7
123
- signing_key:
124
- specification_version: 3
125
- 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
126
127
  test_files: []
127
-
data/Gemfile DELETED
@@ -1,9 +0,0 @@
1
- source :rubygems
2
-
3
- gem 'localized_each_validator', '>= 1.0.1'
4
-
5
- group :development do
6
- gem 'jeweler'
7
- gem 'yard'
8
- gem 'RedCloth', require: 'redcloth'
9
- end
data/Gemfile.lock DELETED
@@ -1,37 +0,0 @@
1
- GEM
2
- remote: http://rubygems.org/
3
- specs:
4
- RedCloth (4.2.3)
5
- activemodel (3.0.3)
6
- activesupport (= 3.0.3)
7
- builder (~> 2.1.2)
8
- i18n (~> 0.4)
9
- activerecord (3.0.3)
10
- activemodel (= 3.0.3)
11
- activesupport (= 3.0.3)
12
- arel (~> 2.0.2)
13
- tzinfo (~> 0.3.23)
14
- activesupport (3.0.3)
15
- arel (2.0.3)
16
- builder (2.1.2)
17
- git (1.2.5)
18
- i18n (0.4.2)
19
- jeweler (1.5.1)
20
- bundler (~> 1.0.0)
21
- git (>= 1.2.5)
22
- rake
23
- localized_each_validator (1.0.1)
24
- activerecord (>= 3.0)
25
- activesupport (>= 3.0)
26
- rake (0.8.7)
27
- tzinfo (0.3.23)
28
- yard (0.6.2)
29
-
30
- PLATFORMS
31
- ruby
32
-
33
- DEPENDENCIES
34
- RedCloth
35
- jeweler
36
- localized_each_validator (>= 1.0.1)
37
- yard
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 (Oct 30, 2010) |
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>
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 1.0.0