Skip to content
Snippets Groups Projects
Commit ec1727a1 authored by Jack Nagel's avatar Jack Nagel
Browse files

Remove backports for Ruby 1.8.6

refs. Homebrew/linuxbrew#438, mistydemeo/tigerbrew#327,
mistydemeo/tigerbrew#334
parent 09f8c54f
No related branches found
No related tags found
No related merge requests found
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 ...@@ -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
......
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' ...@@ -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'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment