ruby-nuggets 0.2.8.262 → 0.2.9.266
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/HEADER +27 -0
- data/README +1 -1
- data/lib/nuggets/uri/content_type.rb +2 -1
- data/lib/nuggets/util/added_methods.rb +6 -6
- data/lib/nuggets/version.rb +1 -1
- metadata +46 -45
data/HEADER
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
#--
|
2
|
+
###############################################################################
|
3
|
+
# #
|
4
|
+
# A component of ruby-nuggets, some extensions to the Ruby programming #
|
5
|
+
# language. #
|
6
|
+
# #
|
7
|
+
# Copyright (C) 2007-2008 Jens Wille #
|
8
|
+
# #
|
9
|
+
# Authors: #
|
10
|
+
# Jens Wille <jens.wille@uni-koeln.de> #
|
11
|
+
# #
|
12
|
+
# ruby-nuggets is free software; you can redistribute it and/or modify it #
|
13
|
+
# under the terms of the GNU General Public License as published by the Free #
|
14
|
+
# Software Foundation; either version 3 of the License, or (at your option) #
|
15
|
+
# any later version. #
|
16
|
+
# #
|
17
|
+
# ruby-nuggets is distributed in the hope that it will be useful, but WITHOUT #
|
18
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
|
20
|
+
# more details. #
|
21
|
+
# #
|
22
|
+
# You should have received a copy of the GNU General Public License along #
|
23
|
+
# with ruby-nuggets. If not, see <http://www.gnu.org/licenses/>. #
|
24
|
+
# #
|
25
|
+
###############################################################################
|
26
|
+
#++
|
27
|
+
|
data/README
CHANGED
@@ -38,7 +38,7 @@ module URI
|
|
38
38
|
# Return the content type of +uri+, or +nil+ if not found.
|
39
39
|
def content_type(uri)
|
40
40
|
open(uri.to_s).content_type
|
41
|
-
rescue OpenURI::HTTPError, SocketError, Errno::ENOENT, NoMethodError
|
41
|
+
rescue OpenURI::HTTPError, SocketError, Errno::ENOENT, Errno::EHOSTUNREACH, NoMethodError
|
42
42
|
nil
|
43
43
|
end
|
44
44
|
|
@@ -58,6 +58,7 @@ if $0 == __FILE__
|
|
58
58
|
http://blackwinter.de/misc/blanc60302523.nth
|
59
59
|
http://blackwinter.de/bla
|
60
60
|
http://blawinter.de
|
61
|
+
http://192.168.12.34/foo/bar
|
61
62
|
].each { |u|
|
62
63
|
p [u, URI.content_type(u)]
|
63
64
|
}
|
@@ -48,13 +48,13 @@ module Util
|
|
48
48
|
# )
|
49
49
|
#
|
50
50
|
# # get the class(es) where matching method(s) were defined
|
51
|
-
# matches.each { |am| puts am[:
|
51
|
+
# matches.each { |am| puts am.klass # also am[:klass] or am[:class] }
|
52
52
|
#
|
53
53
|
# # assume the first one is the one we're looking for
|
54
54
|
# am = matches.first
|
55
55
|
#
|
56
56
|
# # is it a singleton method?
|
57
|
-
# puts am.singleton
|
57
|
+
# puts am.singleton?
|
58
58
|
#
|
59
59
|
# # where exactly has it been defined?
|
60
60
|
# puts "#{am.file}, line #{am.line}"
|
@@ -195,7 +195,7 @@ module Util
|
|
195
195
|
|
196
196
|
def define_callback(name, regexp = //, klasses = [], &outer_block)
|
197
197
|
raise TypeError, "wrong argument type #{name.class} (expected Symbol)" unless name.is_a?(Symbol)
|
198
|
-
raise "callback with name #{name} already exists" if callbacks.
|
198
|
+
raise "callback with name #{name} already exists" if callbacks.assoc(name)
|
199
199
|
|
200
200
|
raise TypeError, "wrong argument type #{regexp.class} (expected Regexp)" unless regexp.is_a?(Regexp)
|
201
201
|
raise TypeError, "wrong argument type #{klasses.class} (expected container object)" unless klasses.respond_to?(:empty?) && klasses.respond_to?(:include?)
|
@@ -269,9 +269,9 @@ module Util
|
|
269
269
|
entries.each { |am|
|
270
270
|
results << am if conditions.all? { |key, value|
|
271
271
|
case value
|
272
|
-
when Array:
|
273
|
-
when Regexp: am[key].to_s
|
274
|
-
else
|
272
|
+
when Array, Range: value.include?(am[key])
|
273
|
+
when Regexp: value =~ am[key].to_s
|
274
|
+
else value == am[key]
|
275
275
|
end
|
276
276
|
}
|
277
277
|
}
|
data/lib/nuggets/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-nuggets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.9.266
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jens Wille
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-07-
|
12
|
+
date: 2008-07-30 00:00:00 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -25,71 +25,72 @@ extra_rdoc_files:
|
|
25
25
|
- README
|
26
26
|
files:
|
27
27
|
- lib/nuggets.rb
|
28
|
-
- lib/nuggets/all.rb
|
29
|
-
- lib/nuggets/version.rb
|
30
|
-
- lib/nuggets/io/agrep.rb
|
31
|
-
- lib/nuggets/io/modes.rb
|
32
|
-
- lib/nuggets/file/which.rb
|
33
|
-
- lib/nuggets/integer/factorial.rb
|
34
28
|
- lib/nuggets/integer/to_binary_s.rb
|
35
|
-
- lib/nuggets/
|
36
|
-
- lib/nuggets/
|
37
|
-
- lib/nuggets/array/format.rb
|
38
|
-
- lib/nuggets/array/in_order.rb
|
39
|
-
- lib/nuggets/array/combination.rb
|
40
|
-
- lib/nuggets/array/flatten_once.rb
|
41
|
-
- lib/nuggets/array/rand.rb
|
42
|
-
- lib/nuggets/array/monotone.rb
|
43
|
-
- lib/nuggets/uri/exist.rb
|
44
|
-
- lib/nuggets/uri/content_type.rb
|
45
|
-
- lib/nuggets/proc/bind.rb
|
46
|
-
- lib/nuggets/string/word_wrap.rb
|
47
|
-
- lib/nuggets/string/msub.rb
|
48
|
-
- lib/nuggets/string/case.rb
|
49
|
-
- lib/nuggets/string/sub_with_md.rb
|
50
|
-
- lib/nuggets/string/evaluate.rb
|
51
|
-
- lib/nuggets/string/nsub.rb
|
52
|
-
- lib/nuggets/string/capitalize_first.rb
|
53
|
-
- lib/nuggets/object/blank.rb
|
29
|
+
- lib/nuggets/integer/factorial.rb
|
30
|
+
- lib/nuggets/version.rb
|
54
31
|
- lib/nuggets/object/metaclass.rb
|
55
|
-
- lib/nuggets/object/uniclass.rb
|
56
32
|
- lib/nuggets/object/singleton_class.rb
|
33
|
+
- lib/nuggets/object/virtual_class.rb
|
57
34
|
- lib/nuggets/object/ghost_class.rb
|
58
35
|
- lib/nuggets/object/eigenclass.rb
|
59
|
-
- lib/nuggets/object/
|
36
|
+
- lib/nuggets/object/blank.rb
|
60
37
|
- lib/nuggets/object/msend.rb
|
61
|
-
- lib/nuggets/
|
38
|
+
- lib/nuggets/object/uniclass.rb
|
39
|
+
- lib/nuggets/enumerable/agrep.rb
|
40
|
+
- lib/nuggets/enumerable/all_any_extended.rb
|
41
|
+
- lib/nuggets/enumerable/minmax.rb
|
42
|
+
- lib/nuggets/all.rb
|
43
|
+
- lib/nuggets/string/sub_with_md.rb
|
44
|
+
- lib/nuggets/string/msub.rb
|
45
|
+
- lib/nuggets/string/case.rb
|
46
|
+
- lib/nuggets/string/evaluate.rb
|
47
|
+
- lib/nuggets/string/word_wrap.rb
|
48
|
+
- lib/nuggets/string/nsub.rb
|
49
|
+
- lib/nuggets/string/capitalize_first.rb
|
50
|
+
- lib/nuggets/hash/in_order.rb
|
51
|
+
- lib/nuggets/hash/insert.rb
|
52
|
+
- lib/nuggets/proc/bind.rb
|
53
|
+
- lib/nuggets/array/rand.rb
|
54
|
+
- lib/nuggets/array/to_hash.rb
|
55
|
+
- lib/nuggets/array/flatten_once.rb
|
56
|
+
- lib/nuggets/array/in_order.rb
|
57
|
+
- lib/nuggets/array/shuffle.rb
|
58
|
+
- lib/nuggets/array/monotone.rb
|
59
|
+
- lib/nuggets/array/format.rb
|
60
|
+
- lib/nuggets/array/combination.rb
|
62
61
|
- lib/nuggets/numeric/between.rb
|
63
62
|
- lib/nuggets/numeric/signum.rb
|
63
|
+
- lib/nuggets/numeric/limit.rb
|
64
64
|
- lib/nuggets/numeric/to_multiple.rb
|
65
|
-
- lib/nuggets/util/
|
66
|
-
- lib/nuggets/util/
|
65
|
+
- lib/nuggets/util/added_methods/init.rb
|
66
|
+
- lib/nuggets/util/added_methods.rb
|
67
67
|
- lib/nuggets/util/ansicolor2css.rb
|
68
68
|
- lib/nuggets/util/content_type.rb
|
69
|
-
- lib/nuggets/util/
|
70
|
-
- lib/nuggets/util/
|
71
|
-
- lib/nuggets/
|
72
|
-
- lib/nuggets/
|
73
|
-
- lib/nuggets/
|
74
|
-
- lib/nuggets/
|
75
|
-
- lib/nuggets/
|
69
|
+
- lib/nuggets/util/dotted_decimal.rb
|
70
|
+
- lib/nuggets/util/i18n.rb
|
71
|
+
- lib/nuggets/file/which.rb
|
72
|
+
- lib/nuggets/uri/content_type.rb
|
73
|
+
- lib/nuggets/uri/exist.rb
|
74
|
+
- lib/nuggets/io/modes.rb
|
75
|
+
- lib/nuggets/io/agrep.rb
|
76
76
|
- COPYING
|
77
|
-
-
|
77
|
+
- HEADER
|
78
78
|
- README
|
79
79
|
- ChangeLog
|
80
|
+
- Rakefile
|
80
81
|
has_rdoc: true
|
81
82
|
homepage: http://prometheus.rubyforge.org/ruby-nuggets
|
82
83
|
post_install_message:
|
83
84
|
rdoc_options:
|
84
|
-
- --all
|
85
|
-
- --main
|
86
|
-
- README
|
87
|
-
- --line-numbers
|
88
|
-
- --inline-source
|
89
85
|
- --title
|
90
86
|
- ruby-nuggets Application documentation
|
91
87
|
- --charset
|
92
88
|
- UTF-8
|
89
|
+
- --main
|
90
|
+
- README
|
91
|
+
- --all
|
92
|
+
- --line-numbers
|
93
|
+
- --inline-source
|
93
94
|
require_paths:
|
94
95
|
- lib
|
95
96
|
required_ruby_version: !ruby/object:Gem::Requirement
|