where_is 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f306ef08ef7d1741687639fb23e8fd2c548aa596
4
- data.tar.gz: d192d9414cede7645d027df092051882a0b71598
3
+ metadata.gz: b6c7084127b003a146f929e32f5c7682be7adc42
4
+ data.tar.gz: e0e7c87c2bdaf475baa3d3b0d4d35e2d5a8efa80
5
5
  SHA512:
6
- metadata.gz: 574345e79412de82a51dbf8df6c4391931b283854e7eccf869be8a051ea295ab39a77c32b56d3c1083839b7e25d6d7102fe9e975eb805f264c7f54bd723fd07f
7
- data.tar.gz: 7dcbd32e3a79404686153d5582fa13b9db90e110098090a0bf0ec16109b99da493c8883aa3c70e3fceb883a97922897d599ca6d00e9c9f4c14061a425cb87cad
6
+ metadata.gz: f07a78076b84383157fdbd7246f5900bad72c9c8768d7676743a4cf180c72194765e8653bec37651b17d720c18b4f49806382a62a32ae94b436355796878fc6f
7
+ data.tar.gz: 848a7dce9d1b383b8192fa31369748402527cb3dcc0c5aef169bb6515904b051e567066eed5e5503db17087b8c77a47cb70fe36c28a7709d21c421e07325138e
data/.rubocop.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  AllCops:
2
2
  DisplayCopNames: true
3
3
 
4
- Style/PredicateName:
4
+ Naming/PredicateName:
5
5
  Enabled: false
6
6
 
7
7
  Style/Documentation:
data/README.md CHANGED
@@ -24,16 +24,16 @@ Or install it yourself as:
24
24
  # Where.is takes a class and an optional method
25
25
 
26
26
  Where.is(Where, :is)
27
- # => ["/Users/david/.rvm/gems/ruby-2.3.1/gems/where_is-0.1.0/lib/where_is.rb", 5]
27
+ # => ["/Users/david/.rvm/gems/ruby-2.3.1/gems/where_is-0.2.0/lib/where_is.rb", 5]
28
28
 
29
29
  Where.is(IRB)
30
- # => ["/Users/david/.rvm/rubies/ruby-2.3.1/lib/ruby/2.2.0/irb/inspector.rb", 24]
30
+ # => ["/Users/david/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/irb/inspector.rb", 24]
31
31
 
32
32
 
33
33
  # Where.are takes a class and an optional method and will return all definitions
34
34
  # of the method/class
35
35
  Where.are(Where, :is)
36
-
36
+ # => [["/Users/david/.rvm/gems/ruby-2.3.1/gems/where_is-0.2.0/lib/where_is.rb", 5]]
37
37
 
38
38
  Where.are(IRB)
39
39
  # => [
@@ -43,6 +43,10 @@ Where.are(IRB)
43
43
  # ["/Users/david/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/irb.rb", 350],
44
44
  # ["/Users/david/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/irb/init.rb", 16]
45
45
  #]
46
+
47
+
48
+ Where.is(String, :unknown_method)
49
+ # NameError: undefined method `unknown_method' for class `#<Class:String>'
46
50
  ```
47
51
 
48
52
  ## Development
@@ -1,3 +1,3 @@
1
1
  module Where
2
- VERSION = '0.2.0'.freeze
2
+ VERSION = '0.3.0'.freeze
3
3
  end
data/lib/where_is.rb CHANGED
@@ -80,7 +80,15 @@ module Where
80
80
  private
81
81
 
82
82
  def source_location(method)
83
- method.source_location || method.to_s[/: (.*)>/, 1]
83
+ source_location = method.source_location
84
+ return method.to_s[/: (.*)>/, 1] if source_location.nil?
85
+
86
+ # source_location is a 2 element array
87
+ # [filename, line_number]
88
+ # some terminals (eg. iterm) will jump to the file if you cmd+click it
89
+ # but they can jump to the specific line if you concat file & line number
90
+ filename, line = source_location
91
+ { file: filename, line: line, path: "#{filename}:#{line}" }
84
92
  end
85
93
 
86
94
  def group_and_combine_source_locations(source_locations)
data/where_is.gemspec CHANGED
@@ -1,5 +1,4 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
1
+ lib = File.expand_path('lib', __dir__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
3
  require 'where_is/version'
5
4
 
@@ -25,5 +24,5 @@ Gem::Specification.new do |spec|
25
24
 
26
25
  spec.add_development_dependency 'bundler', '~> 1.13'
27
26
  spec.add_development_dependency 'rake', '~> 10.0'
28
- spec.add_development_dependency 'rubocop', '~> 0.45.0'
27
+ spec.add_development_dependency 'rubocop', '~> 0.53.0'
29
28
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: where_is
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dave Allie
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-11-23 00:00:00.000000000 Z
11
+ date: 2018-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.45.0
47
+ version: 0.53.0
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.45.0
54
+ version: 0.53.0
55
55
  description: A little Ruby gem for finding the source location where class and methods
56
56
  are defined.
57
57
  email:
@@ -92,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
92
  version: '0'
93
93
  requirements: []
94
94
  rubyforge_project:
95
- rubygems_version: 2.5.1
95
+ rubygems_version: 2.6.8
96
96
  signing_key:
97
97
  specification_version: 4
98
98
  summary: A little Ruby gem for finding the source location where class and methods