summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJohn Mair <jrmair@gmail.com>2011-03-16 18:25:04 +1300
committerJohn Mair <jrmair@gmail.com>2011-03-16 18:25:04 +1300
commit67675b4bb5fe837968c582a18a12cc4cc0ca802f (patch)
tree4c5a1272a9b695b8e3e399e96fedfe96a989b53e /lib
parentc8279c143d649e00da7929f52493e9e1fd9de0c9 (diff)
downloadmethod_source-67675b4bb5fe837968c582a18a12cc4cc0ca802f.tar.gz
version 0.4.0, added proper support for immediate values to
source_location in 1.8.
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