Imported Upstream version 1.46.0
[platform/upstream/nghttp2.git] / third-party / mruby / lib / mruby-core-ext.rb
index 08e6f61..433f1bb 100644 (file)
@@ -1,3 +1,5 @@
+autoload :Pathname, 'pathname'
+
 class Object
   class << self
     def attr_block(*syms)
@@ -16,68 +18,10 @@ 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
-
-if $verbose.nil?
-  if Rake.respond_to?(:verbose) && !Rake.verbose.nil?
-    if Rake.verbose.class == TrueClass
-      # verbose message logging
-      $pp_show = false
-    else
-      $pp_show = true
-      Rake.verbose(false)
-    end
-  else
-    # could not identify rake version
-    $pp_show = false
-  end
-else
-  $pp_show = false if $verbose
 end
 
 def _pp(cmd, src, tgt=nil, options={})
-  return unless $pp_show
+  return if Rake.verbose
 
   width = 5
   template = options[:indent] ? "%#{width*options[:indent]}s %s %s" : "%-#{width}s %s %s"