ip_address_serializer2 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rubocop.yml +92 -0
- data/.travis.yml +9 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +60 -0
- data/LICENSE.txt +21 -0
- data/README.md +61 -0
- data/Rakefile +12 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/ip_address_serializer2.gemspec +39 -0
- data/lib/ip_address_serializer2.rb +75 -0
- data/lib/ip_address_serializer2/version.rb +5 -0
- metadata +146 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b1af3aef4f86d6d6c65910c1c10f2c7b165e038b6dee362de779be159e55ece4
|
4
|
+
data.tar.gz: '038f0e10c10cfd129b6cb7f0a5b93e5dbd16d471b0777cbe5d25b2339942b99f'
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b8a7e1878c39cce72cf940befc5e659b267ca7c97bc43603c790f77f36e6e53ef29e2472d9ae67b7971c8351be71d2a3486a62d705f3b46fb51573aa7b0b78c0
|
7
|
+
data.tar.gz: 9babd801e6f74e2f337702da76f06df4ba5367866e5180fe690636d0a871727cc86d873fac2ee12f28d7f6b969c8ae3a3765abacc0c97e316ce472b840417e11
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
Layout/EmptyLinesAroundAttributeAccessor:
|
2
|
+
Enabled: true
|
3
|
+
Layout/LineLength:
|
4
|
+
Exclude:
|
5
|
+
- test/**/*
|
6
|
+
Max: 120
|
7
|
+
Layout/SpaceAroundMethodCallOperator:
|
8
|
+
Enabled: true
|
9
|
+
Lint/BinaryOperatorWithIdenticalOperands:
|
10
|
+
Enabled: true
|
11
|
+
Lint/DeprecatedOpenSSLConstant:
|
12
|
+
Enabled: true
|
13
|
+
Lint/DuplicateElsifCondition:
|
14
|
+
Enabled: true
|
15
|
+
Lint/DuplicateRescueException:
|
16
|
+
Enabled: true
|
17
|
+
Lint/EmptyConditionalBody:
|
18
|
+
Enabled: true
|
19
|
+
Lint/FloatComparison:
|
20
|
+
Enabled: true
|
21
|
+
Lint/MissingSuper:
|
22
|
+
Enabled: true
|
23
|
+
Lint/MixedRegexpCaptureTypes:
|
24
|
+
Enabled: true
|
25
|
+
Lint/OutOfRangeRegexpRef:
|
26
|
+
Enabled: true
|
27
|
+
Lint/RaiseException:
|
28
|
+
Enabled: true
|
29
|
+
Lint/SelfAssignment:
|
30
|
+
Enabled: true
|
31
|
+
Lint/StructNewOverride:
|
32
|
+
Enabled: true
|
33
|
+
Lint/TopLevelReturnWithArgument:
|
34
|
+
Enabled: true
|
35
|
+
Lint/UnreachableLoop:
|
36
|
+
Enabled: true
|
37
|
+
Metrics/BlockLength:
|
38
|
+
Exclude:
|
39
|
+
- test/**/*
|
40
|
+
Metrics/MethodLength:
|
41
|
+
Max: 35
|
42
|
+
Style/AccessorGrouping:
|
43
|
+
Enabled: true
|
44
|
+
Style/ArrayCoercion:
|
45
|
+
Enabled: true
|
46
|
+
Style/BisectedAttrAccessor:
|
47
|
+
Enabled: true
|
48
|
+
Style/CaseLikeIf:
|
49
|
+
Enabled: true
|
50
|
+
Style/ClassAndModuleChildren:
|
51
|
+
AutoCorrect: true
|
52
|
+
Enabled: true
|
53
|
+
EnforcedStyle: nested
|
54
|
+
Style/Documentation:
|
55
|
+
Enabled: true
|
56
|
+
Style/ExplicitBlockArgument:
|
57
|
+
Enabled: true
|
58
|
+
Style/ExponentialNotation:
|
59
|
+
Enabled: true
|
60
|
+
Style/FrozenStringLiteralComment:
|
61
|
+
Enabled: true
|
62
|
+
EnforcedStyle: always
|
63
|
+
Style/GlobalStdStream:
|
64
|
+
Enabled: true
|
65
|
+
Style/HashAsLastArrayItem:
|
66
|
+
Enabled: true
|
67
|
+
Style/HashEachMethods:
|
68
|
+
Enabled: true
|
69
|
+
Style/HashLikeCase:
|
70
|
+
Enabled: true
|
71
|
+
Style/HashTransformKeys:
|
72
|
+
Enabled: true
|
73
|
+
Style/HashTransformValues:
|
74
|
+
Enabled: true
|
75
|
+
Style/OptionalBooleanParameter:
|
76
|
+
Enabled: true
|
77
|
+
Style/RedundantAssignment:
|
78
|
+
Enabled: true
|
79
|
+
Style/RedundantFetchBlock:
|
80
|
+
Enabled: true
|
81
|
+
Style/RedundantFileExtensionInRequire:
|
82
|
+
Enabled: true
|
83
|
+
Style/RedundantRegexpCharacterClass:
|
84
|
+
Enabled: true
|
85
|
+
Style/RedundantRegexpEscape:
|
86
|
+
Enabled: true
|
87
|
+
Style/SingleArgumentDig:
|
88
|
+
Enabled: true
|
89
|
+
Style/SlicingWithRange:
|
90
|
+
Enabled: true
|
91
|
+
Style/StringConcatenation:
|
92
|
+
Enabled: true
|
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at mike.simkins@mac.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [https://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: https://contributor-covenant.org
|
74
|
+
[version]: https://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
ip_address_serializer2 (0.10.0)
|
5
|
+
activemodel (~> 6.0)
|
6
|
+
ruby-ip (~> 0.9)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
activemodel (6.0.3.2)
|
12
|
+
activesupport (= 6.0.3.2)
|
13
|
+
activesupport (6.0.3.2)
|
14
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
15
|
+
i18n (>= 0.7, < 2)
|
16
|
+
minitest (~> 5.1)
|
17
|
+
tzinfo (~> 1.1)
|
18
|
+
zeitwerk (~> 2.2, >= 2.2.2)
|
19
|
+
concurrent-ruby (1.1.7)
|
20
|
+
coveralls (0.8.23)
|
21
|
+
json (>= 1.8, < 3)
|
22
|
+
simplecov (~> 0.16.1)
|
23
|
+
term-ansicolor (~> 1.3)
|
24
|
+
thor (>= 0.19.4, < 2.0)
|
25
|
+
tins (~> 1.6)
|
26
|
+
docile (1.3.2)
|
27
|
+
i18n (1.8.5)
|
28
|
+
concurrent-ruby (~> 1.0)
|
29
|
+
json (2.3.1)
|
30
|
+
minitest (5.14.1)
|
31
|
+
rake (12.3.3)
|
32
|
+
ruby-ip (0.9.3)
|
33
|
+
simplecov (0.16.1)
|
34
|
+
docile (~> 1.1)
|
35
|
+
json (>= 1.8, < 3)
|
36
|
+
simplecov-html (~> 0.10.0)
|
37
|
+
simplecov-html (0.10.2)
|
38
|
+
sync (0.5.0)
|
39
|
+
term-ansicolor (1.7.1)
|
40
|
+
tins (~> 1.0)
|
41
|
+
thor (1.0.1)
|
42
|
+
thread_safe (0.3.6)
|
43
|
+
tins (1.25.0)
|
44
|
+
sync
|
45
|
+
tzinfo (1.2.7)
|
46
|
+
thread_safe (~> 0.1)
|
47
|
+
zeitwerk (2.4.0)
|
48
|
+
|
49
|
+
PLATFORMS
|
50
|
+
ruby
|
51
|
+
|
52
|
+
DEPENDENCIES
|
53
|
+
bundler (~> 2.0)
|
54
|
+
coveralls
|
55
|
+
ip_address_serializer2!
|
56
|
+
minitest (~> 5.0)
|
57
|
+
rake (~> 12.0)
|
58
|
+
|
59
|
+
BUNDLED WITH
|
60
|
+
2.1.4
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 Mike Simkins
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
# IpAddressSerializer2
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/G7M3/ip_address_serializer2.svg?branch=master)](https://travis-ci.org/G7M3/ip_address_serializer2)
|
4
|
+
|
5
|
+
[![Coverage Status](https://coveralls.io/repos/github/G7M3/ip_address_serializer2/badge.svg?branch=master)](https://coveralls.io/github/G7M3/ip_address_serializer2?branch=master)
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'ip_address_serializer2'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
```shell
|
18
|
+
$ bundle install
|
19
|
+
```
|
20
|
+
|
21
|
+
Or install it yourself as:
|
22
|
+
|
23
|
+
```shell
|
24
|
+
$ gem install ip_address_serializer2
|
25
|
+
```
|
26
|
+
|
27
|
+
## Usage
|
28
|
+
|
29
|
+
Once the Gem has been added to your Gemfile, in any model that is required to hold an IP Address, add the
|
30
|
+
following line to your model
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
serialize <field name symbol>, IPAddressSerializer
|
34
|
+
```
|
35
|
+
|
36
|
+
## Development
|
37
|
+
|
38
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
39
|
+
`rake test` to run the tests. You can also run `bin/console` for an interactive prompt
|
40
|
+
that will allow you to experiment.
|
41
|
+
|
42
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
43
|
+
To release a new version, update the version number in `version.rb`, and then run
|
44
|
+
`bundle exec rake release`, which will create a git tag for the version, push git
|
45
|
+
commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
46
|
+
|
47
|
+
## Contributing
|
48
|
+
|
49
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/g7m3/ip\_address\_serializer2.
|
50
|
+
This project is intended to be a safe, welcoming space for collaboration, and contributors are expected
|
51
|
+
to adhere to the [code of conduct](https://github.com/g7m3/ip_address_serializer2/blob/master/CODE_OF_CONDUCT.md).
|
52
|
+
|
53
|
+
|
54
|
+
## License
|
55
|
+
|
56
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
57
|
+
|
58
|
+
## Code of Conduct
|
59
|
+
|
60
|
+
Everyone interacting in the IpAddressSerializer2 project's codebases, issue trackers, chat rooms and
|
61
|
+
mailing lists is expected to follow the [code of conduct](https://github.com/g7m3/ip_address_serializer2/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'ip_address_serializer2'
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require 'irb'
|
15
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'lib/ip_address_serializer2/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'ip_address_serializer2'
|
7
|
+
spec.version = IpAddressSerializer2::VERSION
|
8
|
+
spec.authors = ['Mike Simkins']
|
9
|
+
spec.email = ['software@g7m3.com']
|
10
|
+
|
11
|
+
spec.summary = 'Gem to enable serialized storage of an IP Address in a string'
|
12
|
+
spec.description = 'ActiveRecord Serializer to allow the storage of a CIDR IP Address in a String Field'
|
13
|
+
spec.homepage = 'https://github.com/g7m3/ip_address_serializer2'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
|
16
|
+
|
17
|
+
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
18
|
+
|
19
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
20
|
+
spec.metadata['source_code_uri'] = 'https://github.com/g7m3/ip_address_serializer2'
|
21
|
+
spec.metadata['changelog_uri'] = 'https://github.com/g7m3/ip_address_serializer2/blob.master/CHANGELOG.md'
|
22
|
+
|
23
|
+
spec.add_development_dependency 'bundler', '~> 2.0'
|
24
|
+
spec.add_development_dependency 'minitest', '~> 5.14'
|
25
|
+
spec.add_development_dependency 'rake', '>= 12.3.3'
|
26
|
+
spec.add_development_dependency 'coveralls'
|
27
|
+
|
28
|
+
spec.add_dependency 'activemodel', '~> 6.0'
|
29
|
+
spec.add_dependency 'ruby-ip', '~> 0.9'
|
30
|
+
|
31
|
+
# Specify which files should be added to the gem when it is released.
|
32
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
33
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
34
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
35
|
+
end
|
36
|
+
spec.bindir = 'exe'
|
37
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
38
|
+
spec.require_paths = ['lib']
|
39
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'ip_address_serializer2/version'
|
4
|
+
require 'ip'
|
5
|
+
|
6
|
+
DELIMITER = '^'
|
7
|
+
V4DELIMITER = '~'
|
8
|
+
V6DELIMITER = ':'
|
9
|
+
CTXDELIMITER = '%'
|
10
|
+
|
11
|
+
# This is the main module. It is called IPAddressSerializer to maintain compatability
|
12
|
+
# with the original project, nowever, as it now relies on a custom fork of the ruby-ip
|
13
|
+
# library, then gem is called something different
|
14
|
+
module IPAddressSerializer
|
15
|
+
class Error < StandardError; end
|
16
|
+
|
17
|
+
# Load the value and return the IP Object.
|
18
|
+
# @param [String] value String representation of the IP Object
|
19
|
+
# @return [IP] The IP Object (from ruby-ip)
|
20
|
+
def self.load(value)
|
21
|
+
return nil if value.nil?
|
22
|
+
|
23
|
+
ctext = nil
|
24
|
+
if value.is_a?(String) && value.index(CTXDELIMITER)
|
25
|
+
ctext = value.split(CTXDELIMITER)[1]
|
26
|
+
value = value.split(CTXDELIMITER)[0]
|
27
|
+
end
|
28
|
+
if value.is_a?(String) && value.index(DELIMITER)
|
29
|
+
value = value.gsub(V4DELIMITER, '') if value[1] == '4' && value.index(V4DELIMITER)
|
30
|
+
value = value.gsub(V6DELIMITER, '') if value[1] == '6' && value.index(V6DELIMITER)
|
31
|
+
ip = IP.new(value.split(DELIMITER))
|
32
|
+
ip.ctx = ctext if ctext
|
33
|
+
ip
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# Save the value, which converts either a String, or an IP Object to the String representation for storage
|
38
|
+
# @param [String, IP, IP::V4, IP::V6] String representation, or internal IP representation of an IP Address
|
39
|
+
# @return [String] The encoded string value representing the IP address object
|
40
|
+
def self.dump(value)
|
41
|
+
return nil if value.nil?
|
42
|
+
|
43
|
+
case value
|
44
|
+
when String
|
45
|
+
ip = IP.new(value)
|
46
|
+
when IP, IP::V4, IP::V6
|
47
|
+
ip = value
|
48
|
+
end
|
49
|
+
address = nil
|
50
|
+
if ip.proto == 'v4'
|
51
|
+
rawhex = ip.to_hex
|
52
|
+
address = rawhex[0..1] + V4DELIMITER +
|
53
|
+
rawhex[2..3] + V4DELIMITER +
|
54
|
+
rawhex[4..5] + V4DELIMITER +
|
55
|
+
rawhex[6..7]
|
56
|
+
end
|
57
|
+
if ip.proto == 'v6'
|
58
|
+
rawhex = ip.to_hex
|
59
|
+
address = rawhex[0..3] + V6DELIMITER +
|
60
|
+
rawhex[4..7] + V6DELIMITER +
|
61
|
+
rawhex[8..11] + V6DELIMITER +
|
62
|
+
rawhex[12..15] + V6DELIMITER +
|
63
|
+
rawhex[16..19] + V6DELIMITER +
|
64
|
+
rawhex[20..23] + V6DELIMITER +
|
65
|
+
rawhex[24..27] + V6DELIMITER +
|
66
|
+
rawhex[28..31]
|
67
|
+
end
|
68
|
+
if ip.ctx.nil?
|
69
|
+
[ip.proto, address, ip.pfxlen].join(DELIMITER)
|
70
|
+
else
|
71
|
+
ctext = CTXDELIMITER + ip.ctx.to_s
|
72
|
+
[ip.proto, address, ip.pfxlen, ctext].join(DELIMITER)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
metadata
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ip_address_serializer2
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.10.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Mike Simkins
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-08-25 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: minitest
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '5.14'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '5.14'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 12.3.3
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 12.3.3
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: coveralls
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: activemodel
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '6.0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '6.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: ruby-ip
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.9'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0.9'
|
97
|
+
description: ActiveRecord Serializer to allow the storage of a CIDR IP Address in
|
98
|
+
a String Field
|
99
|
+
email:
|
100
|
+
- software@g7m3.com
|
101
|
+
executables: []
|
102
|
+
extensions: []
|
103
|
+
extra_rdoc_files: []
|
104
|
+
files:
|
105
|
+
- ".gitignore"
|
106
|
+
- ".rubocop.yml"
|
107
|
+
- ".travis.yml"
|
108
|
+
- CODE_OF_CONDUCT.md
|
109
|
+
- Gemfile
|
110
|
+
- Gemfile.lock
|
111
|
+
- LICENSE.txt
|
112
|
+
- README.md
|
113
|
+
- Rakefile
|
114
|
+
- bin/console
|
115
|
+
- bin/setup
|
116
|
+
- ip_address_serializer2.gemspec
|
117
|
+
- lib/ip_address_serializer2.rb
|
118
|
+
- lib/ip_address_serializer2/version.rb
|
119
|
+
homepage: https://github.com/g7m3/ip_address_serializer2
|
120
|
+
licenses:
|
121
|
+
- MIT
|
122
|
+
metadata:
|
123
|
+
allowed_push_host: https://rubygems.org
|
124
|
+
homepage_uri: https://github.com/g7m3/ip_address_serializer2
|
125
|
+
source_code_uri: https://github.com/g7m3/ip_address_serializer2
|
126
|
+
changelog_uri: https://github.com/g7m3/ip_address_serializer2/blob.master/CHANGELOG.md
|
127
|
+
post_install_message:
|
128
|
+
rdoc_options: []
|
129
|
+
require_paths:
|
130
|
+
- lib
|
131
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
132
|
+
requirements:
|
133
|
+
- - ">="
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: 2.3.0
|
136
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
|
+
requirements:
|
138
|
+
- - ">="
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: '0'
|
141
|
+
requirements: []
|
142
|
+
rubygems_version: 3.1.4
|
143
|
+
signing_key:
|
144
|
+
specification_version: 4
|
145
|
+
summary: Gem to enable serialized storage of an IP Address in a string
|
146
|
+
test_files: []
|