summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKoichi ITO <koic.ito@gmail.com>2017-01-11 07:50:20 +0900
committerKoichi ITO <koic.ito@gmail.com>2017-01-11 07:50:20 +0900
commit05ce7fcb22d3c7b0100d328a52376c6d5cb9272a (patch)
treed7956326bc6c835442aeb5231fae790d4dd419c4
parent0c0a0cebbd11f2b44104b8c84b4f9952692422ad (diff)
downloadmethod_source-05ce7fcb22d3c7b0100d328a52376c6d5cb9272a.tar.gz
Integer Unification for Ruby 2.4.0+
-rw-r--r--lib/method_source/code_helpers.rb8
-rw-r--r--lib/method_source/source_location.rb2
-rw-r--r--test/test.rb2
3 files changed, 6 insertions, 6 deletions
diff --git a/lib/method_source/code_helpers.rb b/lib/method_source/code_helpers.rb
index 6c1d53e..9d9da55 100644
--- a/lib/method_source/code_helpers.rb
+++ b/lib/method_source/code_helpers.rb
@@ -6,14 +6,14 @@ module MethodSource
# This is useful to get module or method source code.
#
# @param [Array<String>, File, String] file The file to parse, either as a File or as
- # @param [Fixnum] line_number The line number at which to look.
+ # @param [Integer] line_number The line number at which to look.
# NOTE: The first line in a file is
# line 1!
# @param [Hash] options The optional configuration parameters.
# @option options [Boolean] :strict If set to true, then only completely
# valid expressions are returned. Otherwise heuristics are used to extract
# expressions that may have been valid inside an eval.
- # @option options [Fixnum] :consume A number of lines to automatically
+ # @option options [Integer] :consume A number of lines to automatically
# consume (add to the expression buffer) without checking for validity.
# @return [String] The first complete expression
# @raise [SyntaxError] If the first complete expression can't be identified
@@ -46,7 +46,7 @@ module MethodSource
#
# @param [Array<String>, File, String] file The file to parse, either as a File or as
# a String or an Array of lines.
- # @param [Fixnum] line_number The line number at which to look.
+ # @param [Integer] line_number The line number at which to look.
# NOTE: The first line in a file is line 1!
# @return [String] The comment
def comment_describing(file, line_number)
@@ -84,7 +84,7 @@ module MethodSource
# Get the first expression from the input.
#
# @param [Array<String>] lines
- # @param [Fixnum] consume A number of lines to automatically
+ # @param [Integer] consume A number of lines to automatically
# consume (add to the expression buffer) without checking for validity.
# @yield a clean-up function to run before checking for complete_expression
# @return [String] a valid ruby expression
diff --git a/lib/method_source/source_location.rb b/lib/method_source/source_location.rb
index 1e2a22a..7629869 100644
--- a/lib/method_source/source_location.rb
+++ b/lib/method_source/source_location.rb
@@ -111,7 +111,7 @@ module MethodSource
case
when klass == Symbol
return :a.method(name).source_location
- when klass == Fixnum
+ when klass == Integer
return 0.method(name).source_location
when klass == TrueClass
return true.method(name).source_location
diff --git a/test/test.rb b/test/test.rb
index 4743a50..b99f717 100644
--- a/test/test.rb
+++ b/test/test.rb
@@ -13,7 +13,7 @@ describe MethodSource do
end
it 'should not raise for immediate instance methods' do
- [Symbol, Fixnum, TrueClass, FalseClass, NilClass].each do |immediate_class|
+ [Symbol, Integer, TrueClass, FalseClass, NilClass].each do |immediate_class|
lambda { immediate_class.instance_method(:to_s).source_location }.should.not.raise
end
end