code 0.9.0 → 0.9.1
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/CHANGELOG.md +5 -1
- data/MIT-LICENSE.txt +1 -1
- data/README.md +2 -1
- data/lib/.code.rb.swp +0 -0
- data/lib/code.rb +6 -2
- data/lib/code/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e01cd5cc47136504cba0c1689cec006b96f3fba4
|
4
|
+
data.tar.gz: ce6b33297bae5d7887ebd7870f9df820c358fd63
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e10133d08f515c6cec3b82228c8189fe1ea185a5cc861841b3b4380e8aa8dc973b4ec062f92aaed4dea422677ba2d354234dd786e06deb623ea481b52f1fb0fa
|
7
|
+
data.tar.gz: 3c07e27786c57ed73227f06868e6501d89ae2d05eec83925f97f82943b0bdc37303af8041586a4904368733e1e60528207c81cff4e2cfd80d7a82560eb44d516
|
data/CHANGELOG.md
CHANGED
data/MIT-LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# code [![[version]](https://badge.fury.io/rb/code.svg)](http://badge.fury.io/rb/code)
|
2
2
|
|
3
|
-
Shows a method's code with syntax highlighting. Tries to find
|
3
|
+
Shows a method's code with syntax highlighting. Tries to find a Ruby definition of the method first, then falls back to the C version (if the **core_docs** gem is available).
|
4
4
|
|
5
5
|
## Setup
|
6
6
|
|
@@ -12,6 +12,7 @@ gem install code core_docs
|
|
12
12
|
## Usage
|
13
13
|
|
14
14
|
```ruby
|
15
|
+
>> Code.for :require
|
15
16
|
# in /home/jan/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:38
|
16
17
|
##
|
17
18
|
# When RubyGems is required, Kernel#require is replaced with our own which
|
data/lib/.code.rb.swp
ADDED
Binary file
|
data/lib/code.rb
CHANGED
@@ -36,7 +36,7 @@ module Code
|
|
36
36
|
indent = source.match(/\A +/)
|
37
37
|
source = source.gsub(/^#{indent}/,"")
|
38
38
|
comment = m.comment && !m.comment.empty? ? "#{ m.comment }" : ""
|
39
|
-
location = m.source_location ? "#
|
39
|
+
location = m.source_location ? "#\n# #{ m.source_location*':' }\n#\n" : ""
|
40
40
|
|
41
41
|
display location + comment + source
|
42
42
|
end
|
@@ -51,10 +51,14 @@ module Code
|
|
51
51
|
raise Code::NotFound, 'Method source not found.'
|
52
52
|
else
|
53
53
|
source = method_info.source
|
54
|
-
location = "//
|
54
|
+
location = "//\n// #{cruby_on_github(method_info.file, method_info.line)}\n//\n"
|
55
55
|
comment = method_info.docstring ? method_info.docstring.gsub(/^/, '// ') + "\n" : ""
|
56
56
|
|
57
57
|
display location + comment + source, :c
|
58
58
|
end
|
59
59
|
end
|
60
|
+
|
61
|
+
def self.cruby_on_github(filename, line)
|
62
|
+
"https://github.com/ruby/ruby/blob/ruby_#{RUBY_VERSION[0]}_#{RUBY_VERSION[2]}/#{filename}#L#{line}"
|
63
|
+
end
|
60
64
|
end
|
data/lib/code/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: code
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Lelis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: method_source
|
@@ -56,6 +56,7 @@ files:
|
|
56
56
|
- README.md
|
57
57
|
- Rakefile
|
58
58
|
- code.gemspec
|
59
|
+
- lib/.code.rb.swp
|
59
60
|
- lib/code.rb
|
60
61
|
- lib/code/version.rb
|
61
62
|
homepage: https://github.com/janlelis/code
|
@@ -78,9 +79,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
78
79
|
version: '0'
|
79
80
|
requirements: []
|
80
81
|
rubyforge_project:
|
81
|
-
rubygems_version: 2.
|
82
|
+
rubygems_version: 2.6.8
|
82
83
|
signing_key:
|
83
84
|
specification_version: 4
|
84
85
|
summary: Displays a method's code.
|
85
86
|
test_files: []
|
86
|
-
has_rdoc:
|