Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Ruby 1.9 compatibility

  • Loading branch information...
commit 8598020689d4897b559a6ce086858e12e6c32a75 1 parent 1311468
Sam Stephenson authored July 20, 2009
2  Rakefile
@@ -6,7 +6,7 @@ require "rake/testtask"
6 6
 task :default => :test
7 7
 
8 8
 Rake::TestTask.new do |t|
9  
-  t.libs << "lib test"
  9
+  t.libs += ["lib", "test"]
10 10
   t.test_files = FileList["test/*_test.rb"]
11 11
   t.verbose = true
12 12
 end
9  lib/yui/compressor.rb
@@ -77,12 +77,13 @@ def compress(stream_or_string)
77 77
     private
78 78
       def command_options
79 79
         options.inject([]) do |command_options, (name, argument)|
80  
-          method = "command_option_for_#{name}"
81  
-          if private_methods.include?(method)
82  
-            command_options.concat(send(method, argument))
83  
-          else
  80
+          method = begin
  81
+            method(:"command_option_for_#{name}")
  82
+          rescue NameError
84 83
             raise OptionError, "undefined option #{name.inspect}"
85 84
           end
  85
+
  86
+          command_options.concat(method.call(argument))
86 87
         end
87 88
       end
88 89
 

0 notes on commit 8598020

Please sign in to comment.
Something went wrong with that request. Please try again.