summaryrefslogtreecommitdiff
path: root/lib/hashie/utils.rb
blob: d8e05fe0809b512ad3522bed70a180b7f1774c58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
module Hashie
  # A collection of helper methods that can be used throughout the gem.
  module Utils
    # Describes a method by where it was defined.
    #
    # @param bound_method [Method] The method to describe.
    # @return [String]
    def self.method_information(bound_method)
      if bound_method.source_location
        "defined at #{bound_method.source_location.join(':')}"
      else
        "defined in #{bound_method.owner}"
      end
    end
  end
end