diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2019-08-11 03:23:51 +0900 |
|---|---|---|
| committer | GitHub <[email protected]> | 2019-08-11 03:23:51 +0900 |
| commit | ce7fd7e1a34adfac6974caf3f09ef5899f8a7670 (patch) | |
| tree | 6461d859b8f36b125e89eefd9e6149c55b13374c | |
| parent | 469dbeb42eb254724fdad2b5b8fb621ab8262b86 (diff) | |
| parent | 1868fd453d70009fd4a895b09c236fb8fc653d6c (diff) | |
| download | mruby-ce7fd7e1a34adfac6974caf3f09ef5899f8a7670.tar.gz mruby-ce7fd7e1a34adfac6974caf3f09ef5899f8a7670.zip | |
Merge pull request #4621 from shuujii/remove-monkey-patches-for-Ruby-1.9-or-earlier
Remove monkey patches for Ruby 1.9 or earlier
| -rw-r--r-- | lib/mruby-core-ext.rb | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/lib/mruby-core-ext.rb b/lib/mruby-core-ext.rb index 08e6f6148..8c985f147 100644 --- a/lib/mruby-core-ext.rb +++ b/lib/mruby-core-ext.rb @@ -16,45 +16,6 @@ class String def relative_path relative_path_from(Dir.pwd) end - - # Compatible with 1.9 on 1.8 - unless (sprintf("%{a}", :a => 1) rescue false) - def %(params) - if params.is_a?(Hash) - str = self.clone - params.each do |k, v| - str.gsub!("%{#{k}}") { v } - end - str - else - if params.is_a?(Array) - sprintf(self, *params) - else - sprintf(self, params) - end - end - end - end -end - -class Symbol - # Compatible with 1.9 on 1.8 - unless method_defined?(:to_proc) - def to_proc - proc { |obj, *args| obj.send(self, *args) } - end - end -end - -module Enumerable - # Compatible with 1.9 on 1.8 - unless method_defined?(:each_with_object) - def each_with_object(memo) - return to_enum :each_with_object, memo unless block_given? - each { |obj| yield obj, memo } - memo - end - end end $pp_show = true |
