ruby_ex 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. data/ChangeLog +693 -0
  2. data/NEWS +74 -0
  3. data/SPEC.dyn.yml +6 -6
  4. data/SPEC.gemspec +14 -0
  5. data/SPEC.yml +4 -4
  6. data/lib/abstract.rb +2 -4
  7. data/lib/abstract_node.rb +1 -2
  8. data/lib/algorithms/simulated_annealing.rb +50 -29
  9. data/lib/attributed_class.rb +50 -21
  10. data/lib/auto_object.rb +102 -0
  11. data/lib/blank_slate.rb +102 -0
  12. data/lib/cache.rb +1 -2
  13. data/lib/choose.rb +165 -163
  14. data/lib/commands.rb +2 -3
  15. data/lib/commands/command.rb +47 -20
  16. data/lib/commands/datas.rb +1 -1
  17. data/lib/commands/datas/composite.rb +5 -1
  18. data/lib/commands/datas/data.rb +102 -5
  19. data/lib/commands/datas/factory.rb +13 -6
  20. data/lib/commands/datas/temp.rb +3 -5
  21. data/lib/commands/factory.rb +1 -1
  22. data/lib/commands/helpers.rb +1 -1
  23. data/lib/commands/pipe.rb +10 -1
  24. data/lib/commands/runners.rb +1 -1
  25. data/lib/commands/runners/exec.rb +1 -1
  26. data/lib/commands/runners/fork.rb +3 -16
  27. data/lib/commands/runners/mock.rb +67 -0
  28. data/lib/commands/runners/runner.rb +5 -3
  29. data/lib/commands/runners/system.rb +1 -1
  30. data/lib/commands/seq.rb +2 -1
  31. data/lib/config_file.rb +10 -2
  32. data/lib/const_regexp.rb +1 -2
  33. data/lib/{dlogger.rb → d_logger.rb} +1 -2
  34. data/lib/daemon.rb +1 -2
  35. data/lib/diff.rb +1 -2
  36. data/lib/drb/drb_observable.rb +1 -2
  37. data/lib/drb/drb_observable_pool.rb +2 -2
  38. data/lib/drb/drb_service.rb +1 -2
  39. data/lib/drb/drb_undumped_attributes.rb +1 -2
  40. data/lib/drb/drb_undumped_indexed_object.rb +1 -2
  41. data/lib/drb/insecure_protected_methods.rb +1 -2
  42. data/lib/drb_ex.rb +2 -2
  43. data/lib/file_type.rb +466 -0
  44. data/lib/generate_id.rb +12 -6
  45. data/lib/genpasswd.rb +22 -0
  46. data/lib/hash_eval.rb +83 -0
  47. data/lib/histogram.rb +1 -2
  48. data/lib/hookable.rb +3 -4
  49. data/lib/hooker.rb +1 -3
  50. data/lib/html_encode.rb +191 -0
  51. data/lib/indexed_node.rb +0 -1
  52. data/lib/io_marshal.rb +4 -2
  53. data/lib/ioo.rb +3 -2
  54. data/lib/kill_all.rb +46 -0
  55. data/lib/labeled_node.rb +0 -1
  56. data/lib/logger_observer.rb +8 -4
  57. data/lib/md5sum.rb +3 -3
  58. data/lib/meta_factory.rb +99 -0
  59. data/lib/method_call.rb +87 -0
  60. data/lib/mocks.rb +12 -0
  61. data/lib/mocks/assertions.rb +50 -0
  62. data/lib/mocks/method_logger.rb +40 -0
  63. data/lib/mocks/mock.rb +64 -0
  64. data/lib/mocks/object.rb +47 -0
  65. data/lib/mocks/observer.rb +38 -0
  66. data/lib/module/autoload_tree.rb +30 -29
  67. data/lib/module/hierarchy.rb +176 -171
  68. data/lib/module/instance_method_visibility.rb +39 -38
  69. data/lib/node.rb +0 -1
  70. data/lib/object_monitor.rb +1 -2
  71. data/lib/object_monitor_activity.rb +1 -2
  72. data/lib/observable.rb +1 -2
  73. data/lib/observable_pool.rb +1 -2
  74. data/lib/{orderedhash.rb → ordered_hash.rb} +41 -5
  75. data/lib/pp_hierarchy.rb +7 -2
  76. data/lib/r_path.rb +307 -0
  77. data/lib/random_generators.rb +7 -20
  78. data/lib/random_generators/random_generator.rb +2 -4
  79. data/lib/random_generators/ruby.rb +4 -2
  80. data/lib/regex_path.rb +124 -0
  81. data/lib/ruby_ex.rb +28 -98
  82. data/lib/safe_eval.rb +1 -2
  83. data/lib/sendmail.rb +14 -17
  84. data/lib/service_manager.rb +1 -2
  85. data/lib/shuffle.rb +6 -2
  86. data/lib/spring.rb +1 -2
  87. data/lib/spring_set.rb +1 -2
  88. data/lib/{symtbl.rb → sym_tbl.rb} +90 -5
  89. data/lib/sym_tbl_gsub.rb +227 -0
  90. data/lib/{synflow.rb → syn_flow.rb} +1 -2
  91. data/lib/text.rb +218 -0
  92. data/lib/timeout_ex.rb +1 -2
  93. data/lib/trace.rb +9 -8
  94. data/lib/uri/druby.rb +1 -2
  95. data/lib/uri/file.rb +1 -1
  96. data/lib/uri/ftp_ex.rb +1 -1
  97. data/lib/uri/http_ex.rb +1 -1
  98. data/lib/uri/mysql.rb +121 -0
  99. data/lib/uri/pgsql.rb +19 -38
  100. data/lib/uri/svn.rb +1 -2
  101. data/lib/uri_ex.rb +45 -3
  102. data/lib/verbose_object.rb +181 -38
  103. data/lib/yaml/chop_header.rb +19 -11
  104. data/lib/yaml/transform.rb +17 -11
  105. data/lib/yaml/yregexpath.rb +11 -5
  106. data/test/algorithms/simulated_annealing_test.rb +2 -2
  107. data/test/resources/foo.tar.gz +0 -0
  108. data/test/resources/tar.gz.log +49 -0
  109. data/test/sanity-suite.yml +5 -7
  110. data/test/sanity/multiple-requires.yml +17 -7
  111. data/test/sanity/single-requires.yml +38 -20
  112. data/test/stress-tests/threads_and_exceptions.yml +13 -0
  113. data/test/test-unit-setup.rb +3 -1
  114. data/test/unit-suite.yml +7 -8
  115. metadata +42 -31
  116. data/lib/algorithms.rb +0 -12
  117. data/lib/ask.rb +0 -100
  118. data/lib/checkout.rb +0 -12
  119. data/lib/dumpable_proc.rb +0 -57
  120. data/lib/filetype.rb +0 -229
  121. data/lib/thread_mutex.rb +0 -11
  122. data/lib/yaml/basenode_ext.rb +0 -63
data/lib/generate_id.rb CHANGED
@@ -1,15 +1,14 @@
1
1
  # Copyright:: Copyright (c) 2004 Nicolas Despres. All rights reserved.
2
2
  # Author:: Nicolas Despres <polrop@lrde.epita.fr>.
3
3
  # License:: Gnu General Public License.
4
- # Revision:: $Id: generate_id.rb 279 2005-06-05 17:46:53Z ertai $
4
+ # Revision:: $Id: generate_id.rb 341 2005-09-07 00:01:43Z ertai $
5
5
 
6
6
 
7
- require 'ruby_ex'
8
7
  require 'md5'
9
8
 
10
- module Kernel
9
+ class GenerateId
11
10
 
12
- def generate_id(&already_exist)
11
+ def initialize ( &already_exist )
13
12
  md5 = Digest::MD5::new
14
13
  id = ''
15
14
  begin
@@ -23,8 +22,15 @@ module Kernel
23
22
  id
24
23
  end
25
24
 
26
- end # module Kernel
25
+ end # class GenerateId
26
+
27
+ module Kernel
27
28
 
29
+ def generate_id ( &already_exist )
30
+ GenerateId.new(&already_exist)
31
+ end
32
+
33
+ end # module Kernel
28
34
 
29
35
 
30
36
  test_section __FILE__ do
@@ -34,7 +40,7 @@ test_section __FILE__ do
34
40
  100.times { tab << generate_id }
35
41
  assert_equal(tab.size, tab.uniq.size)
36
42
  end
37
- def test_simple
43
+ def test_complex
38
44
  tab = []
39
45
  bool = true
40
46
  100.times { tab << generate_id { bool = !bool ; bool } }
data/lib/genpasswd.rb ADDED
@@ -0,0 +1,22 @@
1
+ # Copyright:: Copyright (c) 2004, 2005 Nicolas Despres. All rights reserved.
2
+ # Author:: Nicolas Despr�s <nicolas.despres@gmail.com>.
3
+ # License:: Gnu General Public License.
4
+ # Revision:: $Id: genpasswd.rb 339 2005-09-06 23:27:27Z ertai $
5
+
6
+ require 'choose'
7
+
8
+ class Genpasswd
9
+
10
+ def initialize ( length=8 )
11
+ str = new
12
+ length.times do
13
+ str << ('!'..'~').choose
14
+ end
15
+ str
16
+ end
17
+
18
+ end # class Genpasswd
19
+
20
+ def String.genpasswd(length=8)
21
+ Genpasswd.new(length)
22
+ end
data/lib/hash_eval.rb ADDED
@@ -0,0 +1,83 @@
1
+ # Copyright: Copyright (c) 2004 Nicolas Despres. All rights reserved.
2
+ # Author: Nicolas Despr�s <nicolas.despres@gmail.com>.
3
+ # License: Gnu General Public License.
4
+ # $Id: hash_eval.rb 339 2005-09-06 23:27:27Z ertai $
5
+
6
+
7
+ class HashEval
8
+
9
+ def initialize(hash={}, &block)
10
+ @hash = hash
11
+ if block_given?
12
+ if block.arity == -1
13
+ instance_eval(&block)
14
+ else
15
+ block[self]
16
+ end
17
+ end
18
+ end
19
+
20
+ attr_reader :hash
21
+
22
+ def method_missing(meth, *args, &block)
23
+ args << self.class.new(&block).hash if block_given?
24
+ if args.size == 1
25
+ @hash[meth] = args.first
26
+ else
27
+ @hash[meth] = args
28
+ end
29
+ end
30
+
31
+ end # class HashEval
32
+
33
+
34
+ test_section __FILE__ do
35
+
36
+ class HashEvalTest < Test::Unit::TestCase
37
+
38
+ def test_block_without_arg
39
+ hash_eval = HashEval.new do
40
+ k1 'v1'
41
+ k2 do
42
+ k1 'v1'
43
+ end
44
+ k3 'v3' do
45
+ k1 'v4'
46
+ end
47
+ k4 'v5', 'v6'
48
+ k5 do
49
+ k1 'v1'
50
+ k2 do
51
+ k1 'v1'
52
+ end
53
+ end
54
+ @hash[:k6] = 'v10'
55
+ end
56
+ assert_equal 'v1', hash_eval.hash[:k1]
57
+ assert_equal({ :k1 => 'v1'}, hash_eval.hash[:k2])
58
+ assert_equal [ 'v3', {:k1 => 'v4'} ], hash_eval.hash[:k3]
59
+ assert_equal [ 'v5', 'v6' ], hash_eval.hash[:k4]
60
+ assert_equal({:k1=>"v1", :k2=>{:k1=>"v1"}}, hash_eval.hash[:k5])
61
+ assert_equal 'v10', hash_eval.hash[:k6]
62
+ end
63
+
64
+ def test_block_arg
65
+ hash_eval = HashEval.new do |h|
66
+ h.k1 'v1'
67
+ assert self.class != HashEval
68
+ end
69
+ assert_equal 'v1', hash_eval.hash[:k1]
70
+ end
71
+
72
+ def test_no_block
73
+ hash_eval = HashEval.new
74
+ hash_eval[:k1] = 'v1'
75
+ hash_eval.hash[:k2] = 'v2'
76
+ assert_equal [:k1, 'v1'], hash_eval.hash[:[]=]
77
+ assert_equal 'v2', hash_eval.hash[:k2]
78
+ end
79
+
80
+ end # end HashEvalTest
81
+
82
+ end # end test_section
83
+
data/lib/histogram.rb CHANGED
@@ -1,9 +1,8 @@
1
1
  # Copyright:: Copyright (c) 2005 Nicolas Pouillard. All rights reserved.
2
2
  # Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
3
3
  # License:: Gnu General Public License.
4
- # Revision:: $Id: histogram.rb 279 2005-06-05 17:46:53Z ertai $
4
+ # Revision:: $Id: histogram.rb 339 2005-09-06 23:27:27Z ertai $
5
5
 
6
- require 'ruby_ex'
7
6
 
8
7
  class Histogram
9
8
 
data/lib/hookable.rb CHANGED
@@ -1,9 +1,8 @@
1
1
  # Copyright:: Copyright (c) 2005 Nicolas Pouillard. All rights reserved.
2
2
  # Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
3
3
  # License:: Gnu General Public License.
4
- # Revision:: $Id: hookable.rb 279 2005-06-05 17:46:53Z ertai $
4
+ # Revision:: $Id: hookable.rb 343 2005-09-08 01:32:57Z ertai $
5
5
 
6
- require 'ruby_ex'
7
6
  require 'hooker'
8
7
 
9
8
 
@@ -132,7 +131,7 @@ test_section __FILE__ do
132
131
  end
133
132
 
134
133
  def reset
135
- @stack.clear if @stack
134
+ @stack.clear if defined? @stack and @stack
136
135
  end
137
136
  end
138
137
 
@@ -158,7 +157,7 @@ test_section __FILE__ do
158
157
 
159
158
  def run2
160
159
  hook_trigger :hook2, 42
161
- hook_trigger :hook3 rescue nil
160
+ suppress(ArgumentError) { hook_trigger :hook3 }
162
161
  end
163
162
 
164
163
  def << ( hooker )
data/lib/hooker.rb CHANGED
@@ -1,10 +1,8 @@
1
1
  # Copyright:: Copyright (c) 2005 Nicolas Pouillard. All rights reserved.
2
2
  # Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
3
3
  # License:: Gnu General Public License.
4
- # Revision:: $Id: hooker.rb 279 2005-06-05 17:46:53Z ertai $
4
+ # Revision:: $Id: hooker.rb 339 2005-09-06 23:27:27Z ertai $
5
5
 
6
- require 'rubygems'
7
- require_gem 'activesupport'
8
6
  require 'active_support/class_inheritable_attributes'
9
7
 
10
8
 
@@ -0,0 +1,191 @@
1
+ # Copyright:: Copyright (c) 2005 Nicolas Pouillard. All rights reserved.
2
+ # Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
3
+ # License:: Gnu General Public License.
4
+ # Revision:: $Id: html_encode.rb 339 2005-09-06 23:27:27Z ertai $
5
+
6
+ module HtmlEncode
7
+
8
+ class RegexpHashUnion
9
+ attr_reader :regexp
10
+
11
+ def initialize ( aHash )
12
+ @hash = aHash
13
+ @regexp = Regexp.compile(@hash.keys.map { |re| re.source }.join('|'))
14
+ end
15
+
16
+ def gsub! ( anObject )
17
+ @hash.each { |re, str| anObject.gsub!(re, str) }
18
+ self
19
+ end
20
+
21
+ def =~ ( arg )
22
+ @regexp =~ arg
23
+ end
24
+
25
+ end # class RegexpHashUnion
26
+
27
+
28
+ @@html_encode_basic = RegexpHashUnion.new(
29
+ /\"/ => '&quot;',
30
+ /</ => '&lt;',
31
+ />/ => '&gt;',
32
+ /~/ => '&not;'
33
+ )
34
+
35
+ @@html_encode_medium = RegexpHashUnion.new(
36
+ /�/ => '&ccedil;',
37
+ /�/ => '&egrave;',
38
+ /�/ => '&eacute;',
39
+ /�/ => '&ecirc;',
40
+ /�/ => '&euml;',
41
+ /�/ => '&aacute;',
42
+ /�/ => '&acirc;',
43
+ /�/ => '&ocirc;',
44
+ /�/ => '&Eacute;',
45
+ /�/ => '&Ecirc;',
46
+ /�/ => '&Euml;',
47
+ /�/ => '&agrave;',
48
+ /�/ => '&icirc;',
49
+ /�/ => '&iuml;',
50
+ /�/ => '&ugrave;',
51
+ /�/ => '&uacute;',
52
+ /�/ => '&ucirc;',
53
+ /�/ => '&uuml;'
54
+ )
55
+
56
+ @@html_encode_advanced = RegexpHashUnion.new(
57
+ /�/ => '&iexcl;',
58
+ /�/ => '&cent;',
59
+ /�/ => '&pound;',
60
+ /�/ => '&curren;',
61
+ /�/ => '&yen;',
62
+ /�/ => '&brvbar;',
63
+ /�/ => '&sect;',
64
+ /�/ => '&uml;',
65
+ /�/ => '&copy;',
66
+ /�/ => '&ordf;',
67
+ /\�/ => '&laquo;',
68
+ /�/ => '&shy;',
69
+ /�/ => '&reg;',
70
+ /�/ => '&deg;',
71
+ /�/ => '&plusmn;',
72
+ /�/ => '&sup2;',
73
+ /�/ => '&sup3;',
74
+ /�/ => '&acute;',
75
+ /�/ => '&micro;',
76
+ /�/ => '&para;',
77
+ /�/ => '&middot;',
78
+ /�/ => '&cedil;',
79
+ /�/ => '&sup1;',
80
+ /�/ => '&ordm;',
81
+ /\�/ => '&raquo;',
82
+ /�/ => '&iquest;',
83
+ /�/ => '&Agrave;',
84
+ /�/ => '&Aacute;',
85
+ /�/ => '&Acirc;',
86
+ /�/ => '&Atilde;',
87
+ /�/ => '&Auml;',
88
+ /�/ => '&Aring;',
89
+ /�/ => '&AElig;',
90
+ /�/ => '&Ccedil;',
91
+ /�/ => '&Egrave;',
92
+ /�/ => '&Igrave;',
93
+ /�/ => '&Iacute;',
94
+ /�/ => '&Icirc;',
95
+ /�/ => '&Iuml;',
96
+ /�/ => '&Dstrok;',
97
+ /�/ => '&Ntilde;',
98
+ /�/ => '&Ograve;',
99
+ /�/ => '&Oacute;',
100
+ /�/ => '&Ocirc;',
101
+ /�/ => '&Otilde;',
102
+ /�/ => '&Ouml;',
103
+ /�/ => '&times;',
104
+ /�/ => '&Oslash;',
105
+ /�/ => '&Ugrave;',
106
+ /�/ => '&Uacute;',
107
+ /�/ => '&Ucirc;',
108
+ /�/ => '&Uuml;',
109
+ /�/ => '&Yacute;',
110
+ /�/ => '&THORN;',
111
+ /�/ => '&szlig;',
112
+ /�/ => '&atilde;',
113
+ /�/ => '&auml;',
114
+ /�/ => '&aring;',
115
+ /�/ => '&aelig;',
116
+ /�/ => '&eth;',
117
+ /�/ => '&ntilde;',
118
+ /�/ => '&ograve;',
119
+ /�/ => '&oacute;',
120
+ /�/ => '&otilde;',
121
+ /�/ => '&ouml;',
122
+ /�/ => '&divide;',
123
+ /�/ => '&oslash;',
124
+ /�/ => '&igrave;',
125
+ /�/ => '&iacute;',
126
+ /�/ => '&yacute;',
127
+ /�/ => '&thorn;',
128
+ /�/ => '&yuml;'
129
+ )
130
+
131
+ def html_encode!
132
+ gsub!(/&/, '&amp;')
133
+ @@html_encode_basic.gsub!(self)
134
+ self
135
+ end
136
+
137
+ def html_encode_latin1_accents!
138
+ @@html_encode_medium.gsub!(self) if @@html_encode_medium =~ self
139
+ @@html_encode_advanced.gsub!(self) if @@html_encode_advanced =~ self
140
+ self
141
+ end
142
+
143
+ def html_encode_latin1!
144
+ html_encode!
145
+ html_encode_latin1_accents!
146
+ end
147
+
148
+ def html_encode
149
+ dup.html_encode!
150
+ end
151
+
152
+ def html_encode_latin1_accents
153
+ dup.html_encode_latin1_accents!
154
+ end
155
+
156
+ def html_encode_latin1
157
+ dup.html_encode_latin1!
158
+ end
159
+
160
+ end # module HtmlEncode
161
+
162
+ class String
163
+ include HtmlEncode unless include? HtmlEncode
164
+ end # class String
165
+
166
+ test_section __FILE__ do
167
+
168
+ class TestHtmlEncode < ::Test::Unit::TestCase
169
+
170
+ def setup
171
+ @str = '<fo"o>b�a�r'
172
+ end
173
+
174
+ def teardown
175
+ end
176
+
177
+ def test_html_encode
178
+ assert_equal "&lt;fo&quot;o&gt;b�a�r", @str.html_encode
179
+ end
180
+
181
+ def test_html_encode_latin1_accents
182
+ assert_equal '<fo"o>b&eacute;a&Ocirc;r', @str.html_encode_latin1_accents
183
+ end
184
+
185
+ def test_html_encode_latin1
186
+ assert_equal '&lt;fo&quot;o&gt;b&eacute;a&Ocirc;r', @str.html_encode_latin1
187
+ end
188
+
189
+ end # class TestHtmlEncode
190
+
191
+ end
data/lib/indexed_node.rb CHANGED
@@ -6,7 +6,6 @@
6
6
  # $Id: node.rb 171 2005-03-29 09:12:47Z polrop $
7
7
 
8
8
 
9
- require 'ruby_ex'
10
9
  require 'abstract_node'
11
10
 
12
11
 
data/lib/io_marshal.rb CHANGED
@@ -3,10 +3,12 @@
3
3
  # License: Gnu General Public License.
4
4
 
5
5
  # $LastChangedBy: ertai $
6
- # $Id: io_marshal.rb 279 2005-06-05 17:46:53Z ertai $
6
+ # $Id: io_marshal.rb 339 2005-09-06 23:27:27Z ertai $
7
7
 
8
8
 
9
- require 'ruby_ex'
9
+
10
+ module IoMarshal
11
+ end # module IoMarshal
10
12
 
11
13
  class IO
12
14
 
data/lib/ioo.rb CHANGED
@@ -3,10 +3,9 @@
3
3
  # License: Gnu General Public License.
4
4
 
5
5
  # $LastChangedBy: ertai $
6
- # $Id: ioo.rb 279 2005-06-05 17:46:53Z ertai $
6
+ # $Id: ioo.rb 339 2005-09-06 23:27:27Z ertai $
7
7
 
8
8
  require 'delegate'
9
- require 'ruby_ex'
10
9
 
11
10
  # With this class you can easily overwrite only write or read methods
12
11
  # to change the whole IO.
@@ -126,6 +125,8 @@ class IOO < DelegateClass(IO)
126
125
  include ImplIOO
127
126
  end # class IOO
128
127
 
128
+ Ioo = IOO
129
+
129
130
  require 'socket'
130
131
  class TCPSocket
131
132
  alias :real_send :send
data/lib/kill_all.rb ADDED
@@ -0,0 +1,46 @@
1
+ # Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
2
+ # Copyright:: Copyright (c) 2004, 2005 TTK team. All rights reserved.
3
+ # License:: LGPL
4
+ # $Id: kill_all.rb 339 2005-09-06 23:27:27Z ertai $
5
+
6
+ require 'commands'
7
+
8
+ class KillAll
9
+
10
+ attr_accessor :signal
11
+ attr_accessor :regexp
12
+
13
+ PS = 'ps'.to_cmd
14
+
15
+ def initialize ( aSignal='KILL' )
16
+ @signal = aSignal
17
+ @pids = []
18
+ end
19
+
20
+ def call ( aRegexp )
21
+ data = PS['a'].system
22
+ data.output.open do |ps|
23
+ ps.readline
24
+ ps.each do |line|
25
+ if line =~ /^\s*(\d+)(?:\s+\S+){3}\s+(.*)$/
26
+ pid, name = $1.to_i, $2
27
+ if name =~ aRegexp and pid != $$
28
+ @pids << pid
29
+ begin
30
+ Process.kill(@signal, pid)
31
+ rescue
32
+ raise RuntimeError, "Cannot kill #{name}:#{pid}"
33
+ end
34
+ end
35
+ else
36
+ raise RuntimeError, "bad ps output (#{line})"
37
+ end
38
+ end
39
+ end
40
+ end
41
+
42
+ alias :[] :call
43
+
44
+ end # class KillAll
45
+
46
+ KillAll.new[Regexp.new(ARGV[0])] if $0 == __FILE__