Skip to content

Commit 662872d

Browse files
committed
Add LICENSE.txt and README.md
1 parent 6d8d138 commit 662872d

2 files changed

Lines changed: 77 additions & 0 deletions

File tree

‎LICENSE.txt‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Copyright (c) 2002 Hajimu UMEMOTO <ume@mahoroba.org>
2+
Copyright (c) 2007-2017 Akinori MUSHA <knu@iDaemons.org>
3+
4+
Redistribution and use in source and binary forms, with or without
5+
modification, are permitted provided that the following conditions
6+
are met:
7+
1. Redistributions of source code must retain the above copyright
8+
notice, this list of conditions and the following disclaimer.
9+
2. Redistributions in binary form must reproduce the above copyright
10+
notice, this list of conditions and the following disclaimer in the
11+
documentation and/or other materials provided with the distribution.
12+
13+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16+
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19+
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21+
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22+
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23+
SUCH DAMAGE.

‎README.md‎

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# IPAddr
2+
3+
IPAddr provides a set of methods to manipulate an IP address. Both
4+
IPv4 and IPv6 are supported.
5+
6+
## Installation
7+
8+
Add this line to your application's Gemfile:
9+
10+
```ruby
11+
gem 'ipaddr'
12+
```
13+
14+
And then execute:
15+
16+
$ bundle
17+
18+
Or install it yourself as:
19+
20+
$ gem install ipaddr
21+
22+
## Usage
23+
24+
```ruby
25+
require 'ipaddr'
26+
27+
ipaddr1 = IPAddr.new "3ffe:505:2::1"
28+
29+
p ipaddr1 #=> #<IPAddr: IPv6:3ffe:0505:0002:0000:0000:0000:0000:0001/ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff>
30+
31+
p ipaddr1.to_s #=> "3ffe:505:2::1"
32+
33+
ipaddr2 = ipaddr1.mask(48) #=> #<IPAddr: IPv6:3ffe:0505:0002:0000:0000:0000:0000:0000/ffff:ffff:ffff:0000:0000:0000:0000:0000>
34+
35+
p ipaddr2.to_s #=> "3ffe:505:2::"
36+
37+
ipaddr3 = IPAddr.new "192.168.2.0/24"
38+
39+
p ipaddr3 #=> #<IPAddr: IPv4:192.168.2.0/255.255.255.0>
40+
```
41+
42+
## Development
43+
44+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
45+
46+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
47+
48+
## Contributing
49+
50+
Bug reports and pull requests are welcome on GitHub at https://github.com/ruby/ipaddr.
51+
52+
## License
53+
54+
The gem is available as open source under the terms of the [2-Clause BSD License](https://opensource.org/licenses/BSD-2-Clause).

0 commit comments

Comments
 (0)