Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joshuawscott/ipconverter
Fast Ruby C extension for converting IP addresses from string to integer
https://github.com/joshuawscott/ipconverter
Last synced: about 2 months ago
JSON representation
Fast Ruby C extension for converting IP addresses from string to integer
- Host: GitHub
- URL: https://github.com/joshuawscott/ipconverter
- Owner: joshuawscott
- License: mit
- Created: 2014-11-23T06:42:09.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2023-01-24T18:45:24.000Z (almost 2 years ago)
- Last Synced: 2024-05-29T22:45:33.174Z (7 months ago)
- Language: Ruby
- Homepage:
- Size: 26.4 KB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# IpConverter
[![Build Status](https://travis-ci.org/joshuawscott/ipconverter.svg?branch=master)](https://travis-ci.org/joshuawscott/ipconverter)
Library to deal with IP Address conversions/manipulation, such as converting
a string representation like "192.168.2.1" to its integer representation
(3232236033)Tested with Ruby >= 2.0
## Installation
Add this line to your application's Gemfile:
gem 'ipconverter'
And then execute:
$ bundle
Or install it yourself as:
$ gem install ipconverter
## Usage
```
require 'ipconverter'
IpConverter.str_to_int "192.168.2.1"
=> 3232236033
```
str_to_int raises an error if the address is not valid:
```
IpConverter.str_to_int "192.168.2"
=> raises ArgumentError
```## Running the tests
Clone the repo
```
bundle install
bundle exec rake compile
bundle exec rake test
```## Contributing
1. Fork it ( https://github.com/joshuawscott/ipconverter/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request