diff options
| author | Hiroshi Mimaki <[email protected]> | 2019-10-18 14:46:03 +0900 |
|---|---|---|
| committer | Hiroshi Mimaki <[email protected]> | 2019-10-18 14:46:03 +0900 |
| commit | b6546835457d1935a9c77965686b2a1256874d96 (patch) | |
| tree | 724cfd71a7c956b0648e8c58f3717d797fff5f29 /lib/mruby-core-ext.rb | |
| parent | 8ee516436b8d174a50764939bee23a442aa00b3f (diff) | |
| parent | 20d01f118ddb7e7f2f36926a7a3db35573611857 (diff) | |
| download | mruby-b6546835457d1935a9c77965686b2a1256874d96.tar.gz mruby-b6546835457d1935a9c77965686b2a1256874d96.zip | |
Merge master.
Diffstat (limited to 'lib/mruby-core-ext.rb')
| -rw-r--r-- | lib/mruby-core-ext.rb | 41 |
1 files changed, 2 insertions, 39 deletions
diff --git a/lib/mruby-core-ext.rb b/lib/mruby-core-ext.rb index 08e6f6148..7b78bfa91 100644 --- a/lib/mruby-core-ext.rb +++ b/lib/mruby-core-ext.rb @@ -1,3 +1,5 @@ +autoload :Pathname, 'pathname' + class Object class << self def attr_block(*syms) @@ -16,45 +18,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 |
