Skip to content

Commit

Permalink
Pry::Method aliases: line -> source_line, file -> source_file
Browse files Browse the repository at this point in the history
  • Loading branch information
banister committed Nov 28, 2012
1 parent d1489a5 commit 7e37219
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/pry/method.rb
Expand Up @@ -149,7 +149,7 @@ def from_class(klass, name, target=TOPLEVEL_BINDING)
def from_obj(obj, name, target=TOPLEVEL_BINDING)
new(lookup_method_via_binding(obj, name, :method, target)) rescue nil
end

# Get all of the instance methods of a `Class` or `Module`
# @param [Class,Module] klass
# @param [Boolean] include_super Whether to include methods from ancestors.
Expand Down Expand Up @@ -334,12 +334,14 @@ def source_file
source_location.first
end
end
alias_method :file, :source_file

# @return [Fixnum, nil] The line of code in `source_file` which begins
# the method's definition, or `nil` if that information is unavailable.
def source_line
source_location.nil? ? nil : source_location.last
end
alias_method :line, :source_line

# @return [Range, nil] The range of lines in `source_file` which contain
# the method's definition, or `nil` if that information is unavailable.
Expand Down

0 comments on commit 7e37219

Please sign in to comment.