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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7a7b939fc81c175fd4e2b1f0b1c80c48c0b0581c
4
- data.tar.gz: 8bf7922b9a0248111210ffb31a291af4c46df40f
3
+ metadata.gz: e01cd5cc47136504cba0c1689cec006b96f3fba4
4
+ data.tar.gz: ce6b33297bae5d7887ebd7870f9df820c358fd63
5
5
  SHA512:
6
- metadata.gz: cbf364a3586ae292ca1bd595f4e5100c911f6b2461f993384dd9b2576b07c6fd9d6430e3f2cf3b2593ac84aadbc68d83a84bfbcfae68e1c15535fdc6f35d9a5e
7
- data.tar.gz: 2e5b379b87ca8bf7d5260899fe33fdd826c375063865a4b9a63dd58b850ee37b39318058ad64a4f17fb22744a82841f5d149d8f1fbd1d7ad13e011ce72168e48
6
+ metadata.gz: e10133d08f515c6cec3b82228c8189fe1ea185a5cc861841b3b4380e8aa8dc973b4ec062f92aaed4dea422677ba2d354234dd786e06deb623ea481b52f1fb0fa
7
+ data.tar.gz: 3c07e27786c57ed73227f06868e6501d89ae2d05eec83925f97f82943b0bdc37303af8041586a4904368733e1e60528207c81cff4e2cfd80d7a82560eb44d516
@@ -1,6 +1,10 @@
1
1
  ## CHANGELOG
2
2
 
3
+ ### 0.9.1
4
+
5
+ * Show GitHub-URLs for C-Sources
6
+
3
7
  ### 0.9.0
4
8
 
5
- * Inital release
9
+ * Initial release
6
10
 
@@ -1,4 +1,4 @@
1
- Copyright (c) 2015 Jan Lelis, mail@janlelis.de
1
+ Copyright (c) 2015, 2017 Jan Lelis, mail@janlelis.de
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
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 the Ruby definition of method first, then falls back to the C version (if the `core_docs` gem is available).
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
Binary file
@@ -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 ? "# in #{ m.source_location*':' }\n" : ""
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 = "// in #{method_info.file}:#{method_info.line}\n"
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
@@ -1,5 +1,5 @@
1
1
  module Code
2
- VERSION = "0.9.0".freeze
2
+ VERSION = "0.9.1".freeze
3
3
  end
4
4
 
5
5
 
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.0
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: 2015-03-28 00:00:00.000000000 Z
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.4.6
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: