Remove backports for Ruby 1.8.6
refs. Homebrew/linuxbrew#438, mistydemeo/tigerbrew#327, mistydemeo/tigerbrew#334
This commit is contained in:
parent
09f8c54f83
commit
ec1727a1be
@ -1,7 +0,0 @@
|
|||||||
module Enumerable
|
|
||||||
def group_by
|
|
||||||
inject({}) do |h, e|
|
|
||||||
h.fetch(yield(e)) { |k| h[k] = [] } << e; h
|
|
||||||
end
|
|
||||||
end unless method_defined?(:group_by)
|
|
||||||
end
|
|
||||||
@ -15,33 +15,6 @@ class String
|
|||||||
# EOS
|
# EOS
|
||||||
alias_method :undent_________________________________________________________72, :undent
|
alias_method :undent_________________________________________________________72, :undent
|
||||||
|
|
||||||
def start_with?(*prefixes)
|
|
||||||
prefixes.any? do |prefix|
|
|
||||||
if prefix.respond_to?(:to_str)
|
|
||||||
prefix = prefix.to_str
|
|
||||||
self[0, prefix.length] == prefix
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end unless method_defined?(:start_with?)
|
|
||||||
|
|
||||||
def end_with?(*suffixes)
|
|
||||||
suffixes.any? do |suffix|
|
|
||||||
if suffix.respond_to?(:to_str)
|
|
||||||
suffix = suffix.to_str
|
|
||||||
self[-suffix.length, suffix.length] == suffix
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end unless method_defined?(:end_with?)
|
|
||||||
|
|
||||||
# 1.8.7 or later; used in bottle code
|
|
||||||
def rpartition(separator)
|
|
||||||
if ind = rindex(separator)
|
|
||||||
[slice(0, ind), separator, slice(ind+1, -1) || '']
|
|
||||||
else
|
|
||||||
['', '', dup]
|
|
||||||
end
|
|
||||||
end unless method_defined?(:rpartition)
|
|
||||||
|
|
||||||
# String.chomp, but if result is empty: returns nil instead.
|
# String.chomp, but if result is empty: returns nil instead.
|
||||||
# Allows `chuzzle || foo` short-circuits.
|
# Allows `chuzzle || foo` short-circuits.
|
||||||
def chuzzle
|
def chuzzle
|
||||||
|
|||||||
@ -1,5 +0,0 @@
|
|||||||
class Symbol
|
|
||||||
def to_proc
|
|
||||||
proc { |*args| args.shift.send(self, *args) }
|
|
||||||
end unless method_defined?(:to_proc)
|
|
||||||
end
|
|
||||||
@ -3,8 +3,6 @@ require 'extend/fileutils'
|
|||||||
require 'extend/pathname'
|
require 'extend/pathname'
|
||||||
require 'extend/ARGV'
|
require 'extend/ARGV'
|
||||||
require 'extend/string'
|
require 'extend/string'
|
||||||
require 'extend/symbol'
|
|
||||||
require 'extend/enumerable'
|
|
||||||
require 'os'
|
require 'os'
|
||||||
require 'utils'
|
require 'utils'
|
||||||
require 'exceptions'
|
require 'exceptions'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user