method_source 0.9.1 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/method_source/code_helpers.rb +0 -23
- data/lib/method_source/version.rb +1 -1
- data/method_source.gemspec +4 -4
- data/spec/method_source_spec.rb +1 -1
- data/spec/spec_helper.rb +2 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a028cf570a878212656d23cea883b8c951d1faba
|
4
|
+
data.tar.gz: 3470552886d0ea7f7ca782dc3d3dee9aed645776
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 587e875c403107b65ec2148565a1fef1c95e6a4426f691f03750382ba10c894f165818e30c52a69fe07ccdf0cec4290f966a382b107bed9e093efd8b7f13f288
|
7
|
+
data.tar.gz: 3ca93afc377f2f53da696f326251688c9cc45956027cdefca84df8ac37c90be26d31ba60405c8cd0d001e0841999286040a6941acecb679671fa850266a093a1
|
@@ -1,9 +1,6 @@
|
|
1
1
|
module MethodSource
|
2
2
|
|
3
3
|
module CodeHelpers
|
4
|
-
# @return [Boolean]
|
5
|
-
JRUBY_9200 = (defined?(JRUBY_VERSION) || false) && JRUBY_VERSION == '9.2.0.0'
|
6
|
-
|
7
4
|
# Retrieve the first expression starting on the given line of the given file.
|
8
5
|
#
|
9
6
|
# This is useful to get module or method source code.
|
@@ -32,26 +29,6 @@ module MethodSource
|
|
32
29
|
|
33
30
|
extract_first_expression(relevant_lines, options[:consume])
|
34
31
|
rescue SyntaxError => e
|
35
|
-
# JRuby 9.2.0.0 breaks #source_location for Procs (it reports line number
|
36
|
-
# as the last line of the Proc). This raises SyntaxError.
|
37
|
-
# See https://github.com/pry/pry/issues/1804 for details.
|
38
|
-
#
|
39
|
-
# To fix this, this hack rewinds source location one step at a time and
|
40
|
-
# tries to see if the new location is a complete expression.
|
41
|
-
#
|
42
|
-
# TODO: delete this once latest JRuby version is bumped.
|
43
|
-
# See https://github.com/banister/method_source/issues/52
|
44
|
-
if JRUBY_9200 && line_number > 0
|
45
|
-
loop do
|
46
|
-
line_number -= 1
|
47
|
-
|
48
|
-
# Skip empty lines since they are not real expressions.
|
49
|
-
break unless lines[line_number - 1] == "\n"
|
50
|
-
end
|
51
|
-
|
52
|
-
retry
|
53
|
-
end
|
54
|
-
|
55
32
|
raise if options[:strict]
|
56
33
|
|
57
34
|
begin
|
data/method_source.gemspec
CHANGED
@@ -1,20 +1,20 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: method_source 0.9.
|
2
|
+
# stub: method_source 0.9.2 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "method_source".freeze
|
6
|
-
s.version = "0.9.
|
6
|
+
s.version = "0.9.2"
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
9
9
|
s.require_paths = ["lib".freeze]
|
10
10
|
s.authors = ["John Mair (banisterfiend)".freeze]
|
11
|
-
s.date = "2018-11-
|
11
|
+
s.date = "2018-11-12"
|
12
12
|
s.description = "retrieve the sourcecode for a method".freeze
|
13
13
|
s.email = "jrmair@gmail.com".freeze
|
14
14
|
s.files = [".gemtest".freeze, ".travis.yml".freeze, ".yardopts".freeze, "Gemfile".freeze, "LICENSE".freeze, "README.markdown".freeze, "Rakefile".freeze, "lib/method_source.rb".freeze, "lib/method_source/code_helpers.rb".freeze, "lib/method_source/source_location.rb".freeze, "lib/method_source/version.rb".freeze, "method_source.gemspec".freeze, "spec/method_source/code_helpers_spec.rb".freeze, "spec/method_source_spec.rb".freeze, "spec/spec_helper.rb".freeze]
|
15
15
|
s.homepage = "http://banisterfiend.wordpress.com".freeze
|
16
16
|
s.licenses = ["MIT".freeze]
|
17
|
-
s.rubygems_version = "2.6
|
17
|
+
s.rubygems_version = "2.7.6".freeze
|
18
18
|
s.summary = "retrieve the sourcecode for a method".freeze
|
19
19
|
s.test_files = ["spec/method_source/code_helpers_spec.rb".freeze, "spec/method_source_spec.rb".freeze, "spec/spec_helper.rb".freeze]
|
20
20
|
|
data/spec/method_source_spec.rb
CHANGED
@@ -31,7 +31,7 @@ describe MethodSource do
|
|
31
31
|
@hello_comment = "# A comment for hello\n# It spans two lines and is indented by 2 spaces\n"
|
32
32
|
@lambda_comment = "# This is a comment for MyLambda\n"
|
33
33
|
@lambda_source = "MyLambda = lambda { :lambda }\n"
|
34
|
-
@proc_source = "MyProc = Proc.new
|
34
|
+
@proc_source = "MyProc = Proc.new { :proc }\n"
|
35
35
|
@hello_instance_evaled_source = " def hello_\#{name}(*args)\n send_mesg(:\#{name}, *args)\n end\n"
|
36
36
|
@hello_instance_evaled_source_2 = " def \#{name}_two()\n if 44\n 45\n end\n end\n"
|
37
37
|
@hello_class_evaled_source = " def hello_\#{name}(*args)\n send_mesg(:\#{name}, *args)\n end\n"
|
data/spec/spec_helper.rb
CHANGED
@@ -49,11 +49,9 @@ def comment_test5; end
|
|
49
49
|
|
50
50
|
# This is a comment for MyLambda
|
51
51
|
MyLambda = lambda { :lambda }
|
52
|
-
MyProc = Proc.new
|
52
|
+
MyProc = Proc.new { :proc }
|
53
53
|
|
54
54
|
|
55
|
-
end
|
56
|
-
|
57
55
|
name = "name"
|
58
56
|
|
59
57
|
M.instance_eval <<-METHOD, __FILE__, __LINE__ + 1
|
@@ -100,3 +98,4 @@ EOF
|
|
100
98
|
# class_eval without filename and lineno + 1 parameter
|
101
99
|
|
102
100
|
M.class_eval "def #{name}_three; @tempfile.#{name}; end"
|
101
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: method_source
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Mair (banisterfiend)
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-11-
|
11
|
+
date: 2018-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -79,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
79
|
version: '0'
|
80
80
|
requirements: []
|
81
81
|
rubyforge_project:
|
82
|
-
rubygems_version: 2.6.
|
82
|
+
rubygems_version: 2.6.13
|
83
83
|
signing_key:
|
84
84
|
specification_version: 4
|
85
85
|
summary: retrieve the sourcecode for a method
|