Граф коммитов

41 Коммитов

Автор SHA1 Сообщение Дата
knu ab364fb5a8 Import ipaddr 1.2.2
- Enable frozen_string_literal and do a bit of code cleanup


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66432 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-18 05:09:08 +00:00
knu 236e2993ef Include the input in the message when raising InvalidAddressError
[Feature #5987]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64244 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-09 08:40:54 +00:00
shyouhei f2a91397fd Add uplevel keyword to Kernel#warn and use it
If uplevel keyword is given, the warning message is prepended
with caller file and line information and the string "warning: ".
The use of the uplevel keyword makes Kernel#warn format output
similar to how rb_warn formats output.

This patch modifies net/ftp and net/imap to use Kernel#warn
instead of $stderr.puts or $stderr.printf, since they are used
for printing warnings.

This makes lib/cgi/core and tempfile use $stderr.puts instead of
warn for debug logging, since they are used for debug printing
and not for warning.

This does not modify bundler, rubygems, or rdoc, as those are
maintained outside of ruby and probably wish to remain backwards
compatible with older ruby versions.

rb_warn_m code is originally from nobu, but I've changed it
so that it only includes the path and lineno from uplevel
(not the method), and also prepends the string "warning: ",
to make it more similar to rb_warn.

From: Jeremy Evans code@jeremyevans.net
Signed-off-by: Urabe Shyouhei shyouhei@ruby-lang.org


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-12 11:56:25 +00:00
kazu dabdec31e4 Use caller with length to reduce unused strings
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60288 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 14:40:03 +00:00
knu c2db917b3d Import ipaddr 1.2.0
- Add IPAddr#prefix
- Add IPAddr#loopback?
- Add IPAddr#private? [Feature #11666]
- Add IPAddr#link_local? [Feature #10912]
- Reject invalid address mask [Bug #13399]
- Warn that IPAddr#ipv4_compat and #ipv4_compat? are deprecated [#Bug 13769]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60270 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 13:34:19 +00:00
knu 2d8841791f IPAddr#== and IPAddr#<=> no longer raise an exception if coercion fails
* lib/ipaddr.rb (IPAddr#==): If coercion fails, return false
  instead of passing through the exception. [ruby-core:77451]
  [Bug #12799]

* lib/ipaddr.rb (IPAddr#<=>): If coercion fails, return nil
  instead of passing through the exception. [ruby-core:77451]
  [Bug #12799]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56594 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-05 13:53:38 +00:00
nobu 4458026d85 ipaddr: fix typo [ci skip]
* lib/ipaddr.rb: [DOC] fix documentation of IN6MASK to mention
  IPv6.  [Fix GH-1349]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-21 02:18:44 +00:00
naruse 3e92b635fb Add frozen_string_literal: false for all files
When you change this to true, you may need to add more tests.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-16 05:07:31 +00:00
hsbt 2cd1f852e1 * lib/ipaddr.rb, test/test_ipaddr.rb: Reject invalid address contained
EOL string. Patch by @kachick [fix GH-942][Bug #11513]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52244 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-23 07:35:14 +00:00
hsbt f84ef81dad * lib/ipaddr.rb: extracted inline tests into test dir.
* test/test_ipaddr.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46277 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-31 07:36:51 +00:00
knu a16c76f7c5 * lib/ipaddr.rb (IPAddr#in6_addr): Fix a typo with the closing
parenthesis.




git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39300 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-18 07:31:17 +00:00
knu 7d63004fce Fix the IPv6 parser.
* lib/ipaddr.rb (IPAddr#in6_addr): Fix the parser so that it can
  recognize IPv6 addresses with only one edge 16-bit piece
  compressed, like [::2:3:4:5:6:7:8] or [1:2:3:4:5:6:7::].
  [Bug #7477]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-18 03:45:21 +00:00
marcandre 6f64d9eb56 * lib/cgi/core.rb: Use symbols instead of strings for
{const_,instance_variable_}{get,set}. [#7161]

* lib/drb/drb.rb: ditto.

* lib/ipaddr.rb: ditto.

* lib/irb/workspace.rb: ditto.

* lib/monitor.rb: ditto.

* lib/rss/maker/base.rb: ditto.

* lib/rss/rss.rb: ditto.

* lib/xmlrpc/parser.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37688 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-16 16:55:29 +00:00
knu e03d266c1d * lib/ipaddr.rb: Introduce several new error classes where only
ArgumentError and StandardError were used.  IPAddr::Error is
  their common ancestor class that inherits from ArgumentError for
  backward compatibility.  Submitted by Jon Daniel.  Fixes #173 on
  GitHub.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36868 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-31 07:30:22 +00:00
nobu d059d718b5 remove trainling spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36750 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-21 04:50:18 +00:00
knu 866761d2e8 * lib/ipaddr.rb: Inhibit zero-filled octets in an IPv4 address in
all platforms. [ruby-dev:45671]

* lib/ipaddr.rb: Allow the xxxd.d.d.d form not limited to
  IPv4 mapped/compatible addresses.  This change also makes it
  possible for the parser to understand IPv4 mapped and compatible
  IPv6 addresses in non-compressed form.

* lib/ipaddr.rb: Stop exposing IPSocket.valid*? methods which were
  only usable on non-IPv6-ready platforms.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-02 09:18:32 +00:00
drbrain 95e1fc5b4e * lib/ipaddr.rb: Improve documentation. Patch by Sandor Szucs.
[Ruby 1.9 - Bug #4753]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31686 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-22 02:21:56 +00:00
nobu d371e3583e * lib: revert r31635-r31638 and untabify with expand(1).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-19 00:07:25 +00:00
drbrain 7bbf2f3085 * lib: Convert tabs to spaces for ruby files per
http://redmine.ruby-lang.org/projects/ruby/wiki/DeveloperHowto#coding-style
	  Patch by Steve Klabnik [Ruby 1.9 - Bug #4730]
	  Patch by Jason Dew [Ruby 1.9 - Feature #4718]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-18 21:19:18 +00:00
drbrain f347a9212e * lib/ipaddr.rb (unless Socket): Document valid*? methods. Patch by
Sebastian Martinez.  [Ruby 1.9 - Feature #4687]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-13 17:59:35 +00:00
akr 66390013a1 * lib/resolv-replace.rb: specify super class for rdoc.
* lib/ipaddr.rb: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27000 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-21 12:10:53 +00:00
nobu c9dd4823d9 * lib: fixed typo. a patch by Sho Hashimoto in [ruby-dev:40716].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26986 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-20 03:30:59 +00:00
knu 20a684739e * lib/ipaddr.rb (IPAddr#hash): Take account of netmask; submitted
by Nobuhiro IMAI in [ruby-dev:39011]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24411 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-05 15:13:07 +00:00
knu 61c11677c8 * lib/ipaddr.rb (IPAddr#{eql?,hash}): Add IPAddr#{eql?,hash} so
that an IPAddr object can be used as a hash key, a set element,
  etc.; suggested by Nick Brown <nick@nick-brown.com>.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24388 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-04 06:10:42 +00:00
nobu 287a34ae0d * {ext,lib,test}/**/*.rb: removed trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-06 03:56:38 +00:00
ryan 8e05c69aa1 Added changes needed for miniunit. usually from using internal calls that aren't needed anymore.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-23 21:39:21 +00:00
nobu e12e0b337d * lib/ipaddr.rb (IPAddr#initialize): get rid of ArgumentError in
IPAddr#to_range.  a patch from okkez <okkez000 AT gmail.com> in
  [ruby-dev:35091].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17940 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-07 08:12:23 +00:00
knu 47d42038b3 * lib/ipaddr.rb: Say that I am the current maintainer.
* lib/set.rb: Ditto.

* lib/shellwords.rb: Ditto.

* ext/syslog/syslog.txt: Ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15821 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-21 12:15:06 +00:00
knu 228bb8ea4c * lib/ipaddr.rb (in_addr, in6_addr, addr_mask): Make some minor
code optimization.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13629 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-04 19:03:56 +00:00
knu 2a3528a051 * lib/ipaddr.rb (<=>): Implement IPAddr#<=> and make IPAddr
comparable.

* lib/ipaddr.rb (succ): Implement IPAddr#succ.  You can now create
  a range between two IPAddr's, which (Range) object is
  enumeratable.

* lib/ipaddr.rb (to_range): A new method to create a Range object
  for the (network) address.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13628 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-04 18:56:32 +00:00
knu 7a796ddefc * lib/ipaddr.rb (coerce_other): Support type coercion and make &,
|, == and include? accept a string or an integer instead of an
  IPAddr object as the argument.

* lib/ipaddr.rb (initialize): Give better error messages.

* lib/ipaddr.rb: Improve documentation.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13627 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-04 18:23:22 +00:00
drbrain e2c017a8ce Move Example so RDoc picks it up.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10674 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-08-04 20:39:28 +00:00
drbrain 52c034aecb Documentation cleanup.
Includes patches by Hugh Sasse:
* ping.rb
* weakref.rb
* mailread.rb


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10668 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-08-04 18:05:50 +00:00
matz c09cea5e1b * object.c (rb_mod_attr): make Module#attr to be an alias to
attr_reader.  [RCR#331]

* ruby.h: export classes/modules to implement sandbox.
  [ruby-core:08283]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10577 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-07-20 17:36:36 +00:00
usa d85815fbca * lib/ipaddr.rb (test_s_new): typo.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7790 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-01-19 09:14:42 +00:00
usa 2512210f8e * lib/ipaddr.rb (to_s, test_to_s): too many colons with some cases.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7788 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-01-19 09:05:50 +00:00
eban 41a8d90e7b lib/ipaddr.rb (initialize): rescue StandardError.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5210 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-18 06:46:06 +00:00
eban 60f87fe599 * lib/ipaddr.rb (IPSocket::getaddress): merge usa's patch.
[ruby-dev:21678]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5208 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-18 06:38:30 +00:00
eban cd4d74e9be * ext/socket/socket.c (Init_socket): IPv6 is not supported although
AF_INET6 is defined on MinGW.

* lib/ipaddr.rb (AF_INET6): workaround in the environment which does
  not support IPv6.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5187 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-14 10:04:35 +00:00
nobu 8e19c02e8f * lib/ipaddr.rb (include?): Support non-IPAddr parameters by Dave Thomas. [ruby-core:00980]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3718 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-04-24 06:08:32 +00:00
knu 9ec0a96ad4 * MANIFEST, lib/README, lib/ipaddr.rb: Add ipaddr.rb from rough.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3201 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-23 17:07:49 +00:00