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 +4 -4
- data/.rubocop.yml +1 -1
- data/README.md +7 -3
- data/lib/where_is/version.rb +1 -1
- data/lib/where_is.rb +9 -1
- data/where_is.gemspec +2 -3
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6c7084127b003a146f929e32f5c7682be7adc42
|
4
|
+
data.tar.gz: e0e7c87c2bdaf475baa3d3b0d4d35e2d5a8efa80
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f07a78076b84383157fdbd7246f5900bad72c9c8768d7676743a4cf180c72194765e8653bec37651b17d720c18b4f49806382a62a32ae94b436355796878fc6f
|
7
|
+
data.tar.gz: 848a7dce9d1b383b8192fa31369748402527cb3dcc0c5aef169bb6515904b051e567066eed5e5503db17087b8c77a47cb70fe36c28a7709d21c421e07325138e
|
data/.rubocop.yml
CHANGED
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.
|
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.
|
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
|
data/lib/where_is/version.rb
CHANGED
data/lib/where_is.rb
CHANGED
@@ -80,7 +80,15 @@ module Where
|
|
80
80
|
private
|
81
81
|
|
82
82
|
def source_location(method)
|
83
|
-
|
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
|
-
|
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.
|
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.
|
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:
|
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.
|
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.
|
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.
|
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
|