Skip to content

Commit

Permalink
Remove Ruby < 1.8.7 specific extensions.
Browse files Browse the repository at this point in the history
  • Loading branch information
weppos committed Oct 22, 2010
1 parent b9a901a commit d507d7a
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 33 deletions.
23 changes: 0 additions & 23 deletions lib/core_ext.rb
Original file line number Diff line number Diff line change
@@ -1,26 +1,3 @@
unless :to_proc.respond_to?(:to_proc)
class Symbol
# Turns the symbol into a simple proc,
# which is especially useful for enumerations.
#
# Examples
#
# # The same as people.collect { |p| p.name }
# people.collect(&:name)
#
# # The same as people.select { |p| p.manager? }.collect { |p| p.salary }
# people.select(&:manager?).collect(&:salary)
#
# Extracted from ActiveSupport.
#
# Returns a Proc which incapsulates the method business logic.
def to_proc
Proc.new { |*args| args.shift.__send__(self, *args) }
end
end
end


require 'date'

class DateTime
Expand Down
10 changes: 0 additions & 10 deletions test/whois/core_ext_test.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
require 'test_helper'

class SymbolTests < Test::Unit::TestCase

def test_to_proc
assert_equal %w(one two three), [:one, :two, :three].map(&:to_s)
assert_equal(%w(one two three), { 1 => "one", 2 => "two", 3 => "three" }.sort_by(&:first).map(&:last))
end

end


class DateTimeExtCalculationsTest < Test::Unit::TestCase

def test_to_time
Expand Down

0 comments on commit d507d7a

Please sign in to comment.