Extend only when necessary in `lib/mruby-core-ext.rb`
MODIFY
lib/mruby-core-ext.rb
lib/mruby-core-ext.rb
@@ -18,6 +18,7 @@ class String
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
@@ -34,22 +35,27 @@ class String
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

Extend only when necessary in `lib/mruby-core-ext.rb`