summaryrefslogtreecommitdiff
blob: 6d5d8096e9fe73b2d6af3062f67666c1f8fd6052 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
From 0def37146dce8b2795443b04237e4e345dbaf59c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Diego=20Elio=20'Flameeyes'=20Petten=C3=B2?= <flameeyes@gmail.com>
Date: Fri, 15 Jan 2010 14:54:45 +0100
Subject: [PATCH] Make rexcmd.rb compatible with both MRI 1.8.7 and 1.9.

As it was, rex only worked fine with JRuby 1.4.0 on Gentoo, and not with
either MRI implementation. With this change, OPTIONS (which is a string) is
used properly and works with all three implementations.
---
 lib/rexical/rexcmd.rb |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/rexical/rexcmd.rb b/lib/rexical/rexcmd.rb
index 844bbf6..30b3300 100644
--- a/lib/rexical/rexcmd.rb
+++ b/lib/rexical/rexcmd.rb
@@ -63,7 +63,7 @@ EOT
   def initialize
     @status  =  2
     @cmd  =  File.basename($0, ".rb")
-    tmp  =  OPTIONS.collect do |line|
+    tmp  =  OPTIONS.lines.collect do |line|
         next if /\A\s*\z/ === line
         disp, sopt, lopt, takearg, doc  =  line.strip.split(/\s+/, 5)
         a  =  []
@@ -109,7 +109,7 @@ Usage: #{@cmd} [options] <grammar file>
 Options:
     EOT
 
-    OPTIONS.each do |line|
+    OPTIONS.each_line do |line|
       next if line.strip.empty?
       if /\A\s*\z/ === line
         f.puts
-- 
1.6.6