method_source 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e1118a4c5ca09e1fc6975b68f403928990625f5f
4
- data.tar.gz: 300af8354d67837579d383bdc15459b1515421b1
3
+ metadata.gz: bb42b7f77ca24259bb26b26ff3e862d051d33aa9
4
+ data.tar.gz: '01769899a37ee328c75cd352fa560212c83f051a'
5
5
  SHA512:
6
- metadata.gz: eda821b401319fb84c65668d1e627e403315e67fa0932cf04cc6eda25ce032ed1fece20ccb4268568b1d56d1110373050281ae05f86894beeda2f47dd890e1a1
7
- data.tar.gz: 26d6010ff8487756651bf30e449d59fe1cf2729c778db676ce398cce1a6299ddc74c38305fd0b0ced24bd7b7cb7ad4806a3e20f992d58af1861021f6a9943fd6
6
+ metadata.gz: 6f8a3cc1ce051ad79750c4aa096f5e54c0fb7730908c669bd215f1ec98433dfa29bbfd383716344235c0a1dff5abd054d87e4c3b96fc5744b02ad120b4a26fd0
7
+ data.tar.gz: 649cf3eb91ab3fc6c1d2e32736a3a37f90abdfb7334db2b4f3e4d51e9a45a93ca03bd769a230c49230473f2b92f8dcbd4e72f255d8709e7991b01d0945587dff
@@ -16,11 +16,12 @@ rvm:
16
16
  - 2.1
17
17
  - 2.2
18
18
  - 2.3
19
- - 2.4.1
19
+ - 2.4.2
20
20
  - ruby-head
21
21
  matrix:
22
22
  allow_failures:
23
23
  - rvm: ruby-head
24
+ - rvm: jruby
24
25
  - rvm: jruby-head
25
26
  - rvm: rbx-3
26
27
  fast_finish: true
data/Rakefile CHANGED
@@ -19,6 +19,7 @@ def apply_spec_defaults(s)
19
19
  s.email = 'jrmair@gmail.com'
20
20
  s.description = s.summary
21
21
  s.require_path = 'lib'
22
+ s.license = 'MIT'
22
23
 
23
24
  s.add_development_dependency("rspec","~>3.6")
24
25
  s.add_development_dependency("rake", "~>0.9")
@@ -1,6 +1,9 @@
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
+
4
7
  # Retrieve the first expression starting on the given line of the given file.
5
8
  #
6
9
  # This is useful to get module or method source code.
@@ -29,6 +32,26 @@ module MethodSource
29
32
 
30
33
  extract_first_expression(relevant_lines, options[:consume])
31
34
  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
+
32
55
  raise if options[:strict]
33
56
 
34
57
  begin
@@ -1,3 +1,3 @@
1
1
  module MethodSource
2
- VERSION = "0.9.0"
2
+ VERSION = "0.9.1"
3
3
  end
@@ -1,34 +1,35 @@
1
1
  # -*- encoding: utf-8 -*-
2
+ # stub: method_source 0.9.1 ruby lib
2
3
 
3
4
  Gem::Specification.new do |s|
4
- s.name = "method_source"
5
- s.version = "0.8.1"
5
+ s.name = "method_source".freeze
6
+ s.version = "0.9.1"
6
7
 
7
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
- s.authors = ["John Mair (banisterfiend)"]
9
- s.licenses = ['MIT']
10
- s.date = "2012-10-17"
11
- s.description = "retrieve the sourcecode for a method"
12
- s.email = "jrmair@gmail.com"
13
- s.files = [".gemtest", ".travis.yml", ".yardopts", "Gemfile", "LICENSE", "README.markdown", "Rakefile", "lib/method_source.rb", "lib/method_source/code_helpers.rb", "lib/method_source/source_location.rb", "lib/method_source/version.rb", "method_source.gemspec", "spec/method_source/code_helpers_spec.rb", "spec/method_source_spec.rb", "spec/spec_helper.rb"]
14
- s.homepage = "http://banisterfiend.wordpress.com"
15
- s.require_paths = ["lib"]
16
- s.rubygems_version = "1.8.23"
17
- s.summary = "retrieve the sourcecode for a method"
18
- s.test_files = ["spec/method_source/code_helpers_spec.rb", "spec/method_source_spec.rb", "spec/spec_helper.rb"]
8
+ s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
9
+ s.require_paths = ["lib".freeze]
10
+ s.authors = ["John Mair (banisterfiend)".freeze]
11
+ s.date = "2018-11-02"
12
+ s.description = "retrieve the sourcecode for a method".freeze
13
+ s.email = "jrmair@gmail.com".freeze
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
+ s.homepage = "http://banisterfiend.wordpress.com".freeze
16
+ s.licenses = ["MIT".freeze]
17
+ s.rubygems_version = "2.6.14".freeze
18
+ s.summary = "retrieve the sourcecode for a method".freeze
19
+ s.test_files = ["spec/method_source/code_helpers_spec.rb".freeze, "spec/method_source_spec.rb".freeze, "spec/spec_helper.rb".freeze]
19
20
 
20
21
  if s.respond_to? :specification_version then
21
- s.specification_version = 3
22
+ s.specification_version = 4
22
23
 
23
24
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
24
- s.add_development_dependency(%q<rspec>, ["~> 3.6"])
25
- s.add_development_dependency(%q<rake>, ["~> 0.9"])
25
+ s.add_development_dependency(%q<rspec>.freeze, ["~> 3.6"])
26
+ s.add_development_dependency(%q<rake>.freeze, ["~> 0.9"])
26
27
  else
27
- s.add_dependency(%q<rspec>, ["~> 3.6"])
28
- s.add_dependency(%q<rake>, ["~> 0.9"])
28
+ s.add_dependency(%q<rspec>.freeze, ["~> 3.6"])
29
+ s.add_dependency(%q<rake>.freeze, ["~> 0.9"])
29
30
  end
30
31
  else
31
- s.add_dependency(%q<rspec>, ["~> 3.6"])
32
- s.add_dependency(%q<rake>, ["~> 0.9"])
32
+ s.add_dependency(%q<rspec>.freeze, ["~> 3.6"])
33
+ s.add_dependency(%q<rake>.freeze, ["~> 0.9"])
33
34
  end
34
35
  end
@@ -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 { :proc }\n"
34
+ @proc_source = "MyProc = Proc.new do\n\n\nend\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"
@@ -49,9 +49,11 @@ def comment_test5; end
49
49
 
50
50
  # This is a comment for MyLambda
51
51
  MyLambda = lambda { :lambda }
52
- MyProc = Proc.new { :proc }
52
+ MyProc = Proc.new do
53
53
 
54
54
 
55
+ end
56
+
55
57
  name = "name"
56
58
 
57
59
  M.instance_eval <<-METHOD, __FILE__, __LINE__ + 1
@@ -98,4 +100,3 @@ EOF
98
100
  # class_eval without filename and lineno + 1 parameter
99
101
 
100
102
  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.0
4
+ version: 0.9.1
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: 2017-09-26 00:00:00.000000000 Z
11
+ date: 2018-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -60,7 +60,8 @@ files:
60
60
  - spec/method_source_spec.rb
61
61
  - spec/spec_helper.rb
62
62
  homepage: http://banisterfiend.wordpress.com
63
- licenses: []
63
+ licenses:
64
+ - MIT
64
65
  metadata: {}
65
66
  post_install_message:
66
67
  rdoc_options: []
@@ -78,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
78
79
  version: '0'
79
80
  requirements: []
80
81
  rubyforge_project:
81
- rubygems_version: 2.6.12
82
+ rubygems_version: 2.6.14
82
83
  signing_key:
83
84
  specification_version: 4
84
85
  summary: retrieve the sourcecode for a method