summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/method_source/source_location.rb14
-rw-r--r--lib/method_source/version.rb2
2 files changed, 15 insertions, 1 deletions
diff --git a/lib/method_source/source_location.rb b/lib/method_source/source_location.rb
index f1929e1..e018d74 100644
--- a/lib/method_source/source_location.rb
+++ b/lib/method_source/source_location.rb
@@ -44,6 +44,20 @@ module MethodSource
Class.new { include(method_owner) }
end
+ # deal with immediate values
+ case
+ when klass == Symbol
+ return :a.method(name).source_location
+ when klass == Fixnum
+ return 0.method(name).source_location
+ when klass == TrueClass
+ return true.method(name).source_location
+ when klass == FalseClass
+ return false.method(name).source_location
+ when klass == NilClass
+ return nil.method(name).source_location
+ end
+
begin
klass.allocate.method(name).source_location
rescue TypeError
diff --git a/lib/method_source/version.rb b/lib/method_source/version.rb
index 05234be..56956e7 100644
--- a/lib/method_source/version.rb
+++ b/lib/method_source/version.rb
@@ -1,3 +1,3 @@
module MethodSource
- VERSION = "0.3.5"
+ VERSION = "0.4.0"
end