summaryrefslogtreecommitdiff
path: root/lib/method_source.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/method_source.rb')
-rw-r--r--lib/method_source.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/method_source.rb b/lib/method_source.rb
index 6991dfe..7d16c3b 100644
--- a/lib/method_source.rb
+++ b/lib/method_source.rb
@@ -107,7 +107,7 @@ module MethodSource
# self
# end
def source
- MethodSource.source_helper(source_location, name)
+ MethodSource.source_helper(source_location, defined?(name) ? name : inspect)
end
# Return the comments associated with the method as a string.
@@ -119,7 +119,7 @@ module MethodSource
# =>
# # Removes all elements and returns self.
def comment
- MethodSource.comment_helper(source_location, name)
+ MethodSource.comment_helper(source_location, defined?(name) ? name : inspect)
end
end
end