ipconverter 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/ruby.yaml +28 -0
- data/.rubocop.yml +15 -0
- data/Gemfile +2 -0
- data/README.md +3 -1
- data/Rakefile +5 -3
- data/benchmark/int_to_str.rb +2 -0
- data/benchmark/str_to_int.rb +3 -2
- data/ext/ipconverter/extconf.rb +3 -1
- data/ipconverter.gemspec +11 -8
- data/lib/ipconverter/version.rb +3 -1
- data/lib/ipconverter.rb +2 -0
- data/test/test_ipconverter.rb +2 -0
- metadata +23 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 54ad3d7a1a322566c642df08f51b0f86b041dd0a112a30f14162b6405a3c134a
|
4
|
+
data.tar.gz: b0a2978036a14dde903662be197e151e87b762474e1127075d237c655893d9c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19e0ed781d197381e9a5f223561350d295e9bc697faa62d312a0faf0af8b00621db0976b49674739a2ba4e235b45f6060e6a5c47dfa0b669733d1d54e4dbfbf3
|
7
|
+
data.tar.gz: 7655da0d139a1e0aec61f43093334d5c449110ba95c2be9a5d16a366ebb49339eddf6eada918e46ad6085a6b5927189a6dac96cad8bb50ffdab5d071d5fcbc38
|
@@ -0,0 +1,28 @@
|
|
1
|
+
name: Ruby CI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [master]
|
6
|
+
pull_request:
|
7
|
+
branches: [master]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
test:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
|
13
|
+
strategy:
|
14
|
+
matrix:
|
15
|
+
ruby-version: ["3.2", "3.1", "3.0", "2.7", "2.6"]
|
16
|
+
|
17
|
+
steps:
|
18
|
+
- uses: actions/checkout@v3
|
19
|
+
- name: Set up Ruby ${{ matrix.ruby-version }}
|
20
|
+
uses: ruby/setup-ruby@v1.134.0
|
21
|
+
with:
|
22
|
+
ruby-version: ${{ matrix.ruby-version }}
|
23
|
+
- name: Install dependencies
|
24
|
+
run: bundle install
|
25
|
+
- name: Run tests
|
26
|
+
run: bundle exec rake
|
27
|
+
- name: rubocop
|
28
|
+
run: bundle exec rubocop
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: "2.6"
|
3
|
+
Exclude:
|
4
|
+
- "benchmark/**/*"
|
5
|
+
- "tmp/**/*"
|
6
|
+
StringLiterals:
|
7
|
+
Enabled: false
|
8
|
+
SupportedStyles:
|
9
|
+
- single_quotes
|
10
|
+
- double_quotes
|
11
|
+
LineLength:
|
12
|
+
Enabled: true
|
13
|
+
Max: 100
|
14
|
+
Style/AccessModifierDeclarations:
|
15
|
+
Enabled: false
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
# IpConverter
|
2
2
|
|
3
|
+
[![Build Status](https://travis-ci.org/joshuawscott/ipconverter.svg?branch=master)](https://travis-ci.org/joshuawscott/ipconverter)
|
4
|
+
|
3
5
|
Library to deal with IP Address conversions/manipulation, such as converting
|
4
6
|
a string representation like "192.168.2.1" to its integer representation
|
5
7
|
(3232236033)
|
6
8
|
|
7
|
-
Tested with Ruby >=
|
9
|
+
Tested with Ruby >= 2.0
|
8
10
|
|
9
11
|
## Installation
|
10
12
|
|
data/Rakefile
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'bundler/gem_tasks'
|
2
4
|
require 'rake/testtask'
|
3
5
|
require 'rake/extensiontask'
|
4
6
|
|
5
|
-
ROOT = File.expand_path(
|
7
|
+
ROOT = File.expand_path(__dir__)
|
6
8
|
|
7
9
|
Rake::TestTask.new do |t|
|
8
10
|
t.libs << 'test'
|
@@ -10,10 +12,10 @@ Rake::TestTask.new do |t|
|
|
10
12
|
end
|
11
13
|
|
12
14
|
Rake::ExtensionTask.new 'ipconverter' do |ext|
|
13
|
-
ext.lib_dir =
|
15
|
+
ext.lib_dir = File.join %w[lib ipconverter]
|
14
16
|
end
|
15
17
|
|
16
|
-
task default: [
|
18
|
+
task default: %i[compile test]
|
17
19
|
|
18
20
|
desc "Run benchmarks"
|
19
21
|
task benchmark: [:compile] do
|
data/benchmark/int_to_str.rb
CHANGED
data/benchmark/str_to_int.rb
CHANGED
@@ -1,12 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'benchmark'
|
2
4
|
require 'ipaddr'
|
3
5
|
require 'ipconverter'
|
4
6
|
|
5
7
|
def self.pack_unpack(ip)
|
6
|
-
ip.split('.').collect(&:to_i).pack('C*').
|
8
|
+
ip.split('.').collect(&:to_i).pack('C*').unpack1('N')
|
7
9
|
end
|
8
10
|
|
9
|
-
# rubocop:disable AbcSize
|
10
11
|
def self.split_multiply(ip)
|
11
12
|
octets = ip.split('.').map(&:to_i)
|
12
13
|
octets[3] +
|
data/ext/ipconverter/extconf.rb
CHANGED
data/ipconverter.gemspec
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
4
|
+
ext = File.expand_path('ext', __dir__)
|
4
5
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
6
|
$LOAD_PATH.unshift(ext) unless $LOAD_PATH.include?(ext)
|
6
7
|
require 'ipconverter/version'
|
@@ -16,15 +17,17 @@ string to integer'
|
|
16
17
|
spec.homepage = 'http://github.com/joshuawscott/ipconverter'
|
17
18
|
spec.license = 'MIT'
|
18
19
|
|
20
|
+
spec.required_ruby_version = ">= 2.6.0"
|
21
|
+
|
19
22
|
spec.files = `git ls-files -z`.split("\x0")
|
20
23
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
21
24
|
spec.extensions = ['ext/ipconverter/extconf.rb']
|
22
25
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
23
|
-
spec.require_paths = %w
|
26
|
+
spec.require_paths = %w[lib ext]
|
24
27
|
|
25
|
-
spec.add_development_dependency 'bundler'
|
26
|
-
spec.add_development_dependency 'rake', '~> 10'
|
28
|
+
spec.add_development_dependency 'bundler'
|
27
29
|
spec.add_development_dependency 'minitest', '~> 5'
|
28
|
-
spec.add_development_dependency 'rake
|
29
|
-
spec.add_development_dependency '
|
30
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
31
|
+
spec.add_development_dependency 'rake-compiler', '~> 1.0'
|
32
|
+
spec.add_development_dependency 'rubocop', '~> 0.50'
|
30
33
|
end
|
data/lib/ipconverter/version.rb
CHANGED
data/lib/ipconverter.rb
CHANGED
data/test/test_ipconverter.rb
CHANGED
metadata
CHANGED
@@ -1,85 +1,85 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ipconverter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joshua Scott
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: minitest
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '5'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '5'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '13.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '13.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake-compiler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0
|
61
|
+
version: '1.0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0
|
68
|
+
version: '1.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rubocop
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '0.
|
75
|
+
version: '0.50'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '0.
|
82
|
+
version: '0.50'
|
83
83
|
description: |-
|
84
84
|
Fast C extension for converting IP addresses from
|
85
85
|
string to integer
|
@@ -90,7 +90,9 @@ extensions:
|
|
90
90
|
- ext/ipconverter/extconf.rb
|
91
91
|
extra_rdoc_files: []
|
92
92
|
files:
|
93
|
+
- ".github/workflows/ruby.yaml"
|
93
94
|
- ".gitignore"
|
95
|
+
- ".rubocop.yml"
|
94
96
|
- ".yardopts"
|
95
97
|
- Gemfile
|
96
98
|
- LICENSE.txt
|
@@ -109,7 +111,7 @@ homepage: http://github.com/joshuawscott/ipconverter
|
|
109
111
|
licenses:
|
110
112
|
- MIT
|
111
113
|
metadata: {}
|
112
|
-
post_install_message:
|
114
|
+
post_install_message:
|
113
115
|
rdoc_options: []
|
114
116
|
require_paths:
|
115
117
|
- lib
|
@@ -118,16 +120,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
118
120
|
requirements:
|
119
121
|
- - ">="
|
120
122
|
- !ruby/object:Gem::Version
|
121
|
-
version:
|
123
|
+
version: 2.6.0
|
122
124
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
123
125
|
requirements:
|
124
126
|
- - ">="
|
125
127
|
- !ruby/object:Gem::Version
|
126
128
|
version: '0'
|
127
129
|
requirements: []
|
128
|
-
|
129
|
-
|
130
|
-
signing_key:
|
130
|
+
rubygems_version: 3.2.33
|
131
|
+
signing_key:
|
131
132
|
specification_version: 4
|
132
133
|
summary: Utilities for working with IP addresses
|
133
134
|
test_files:
|