mirror of
https://github.com/awesome-print/awesome_print
synced 2023-03-27 23:22:34 -04:00
21 lines
No EOL
557 B
Ruby
21 lines
No EOL
557 B
Ruby
# Copyright (c) 2010-2011 Michael Dvorkin
|
|
#
|
|
# Awesome Print is freely distributable under the terms of MIT license.
|
|
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
|
|
#------------------------------------------------------------------------------
|
|
#
|
|
# Method#name was intorduced in Ruby 1.8.7 so we define it here as necessary.
|
|
#
|
|
unless nil.method(:class).respond_to?(:name)
|
|
class Method
|
|
def name
|
|
inspect.split(/[#.>]/)[-1]
|
|
end
|
|
end
|
|
|
|
class UnboundMethod
|
|
def name
|
|
inspect.split(/[#.>]/)[-1]
|
|
end
|
|
end
|
|
end |