code 0.9.2 → 0.9.4

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
- SHA1:
3
- metadata.gz: 81cb5e2f6899f0fd685ca65d56e08f835f0e9ea4
4
- data.tar.gz: beb04a8e1f9c0984de9f45fd01a2645ac15a7812
2
+ SHA256:
3
+ metadata.gz: 49fe0c5a7b314944359601ecc87e0531e7c9c11b46f09f73cfe7bf07647f1d33
4
+ data.tar.gz: b91b6fc3c2f5c8a15d80f893b06de04b4c3bc1397e2270311cfe0e5ea2c3a9c8
5
5
  SHA512:
6
- metadata.gz: 8b767b711f6afe499008c7f72690c864e2584289b1b952f3f4ccdf83ea86f271189069cb80145aeeb4cdf124add0734d10d2cb0d78ebc4b7c60987b1aae6cab1
7
- data.tar.gz: 8bbc4d1097936e83c712740aec71bec7a05f288d03c45b1b5613fb22c7d730caf02c79e6b00b502912fef34dfd711627db197b3e3f6b3f1dcda78bc6b2273307
6
+ metadata.gz: 0f0526e09b717649255cdc4700c264a6c5efcc5b8fce51ed5e4a64dd3bb20c5d507f7e6d598f7f409f769a94308eef179757f4ac9086f3adf89441913a030814
7
+ data.tar.gz: c5b53aa70dd3c1624e287a05ffa98754a9733bb107c8bd99d2607e336d18d497d3c6c123ffdcb2461c9f170ab114c3b741236c0286b95058601a3f44825614f4
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  ## CHANGELOG
2
2
 
3
+ ### 0.9.4
4
+
5
+ * Support `Method` and `UnboundMethod` objects as argument
6
+
7
+ ### 0.9.3
8
+
9
+ * Loosen dependencies to Ruby and method_source
10
+
3
11
  ### 0.9.2
4
12
 
5
13
  * Update method_source dependency
data/MIT-LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2015, 2017 Jan Lelis, mail@janlelis.de
1
+ Copyright (c) 2015, 2017 Jan Lelis, https://janlelis.com
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,4 +1,4 @@
1
- # code [![[version]](https://badge.fury.io/rb/code.svg)](http://badge.fury.io/rb/code)
1
+ # code [![[version]](https://badge.fury.io/rb/code.svg)](https://badge.fury.io/rb/code)
2
2
 
3
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
 
@@ -160,4 +160,4 @@ Be as powerful as pry's source browsing: https://github.com/pry/pry/wiki/Source-
160
160
 
161
161
  ## MIT License
162
162
 
163
- Copyright (C) 2015 Jan Lelis <http://janlelis.com>. Released under the MIT license.
163
+ Copyright (C) 2015, 2017 Jan Lelis <https://janlelis.com>. Released under the MIT license.
data/code.gemspec CHANGED
@@ -6,9 +6,9 @@ Gem::Specification.new do |gem|
6
6
  gem.name = "code"
7
7
  gem.version = Code::VERSION
8
8
  gem.summary = "Displays a method's code."
9
- gem.description = "Displays a method's code (from source or docs)."
9
+ gem.description = "Displays a method's code (from source or docs). Supports native C source when core_docs gem is available"
10
10
  gem.authors = ["Jan Lelis"]
11
- gem.email = "mail@janlelis.de"
11
+ gem.email = ["hi@ruby.consulting"]
12
12
  gem.homepage = "https://github.com/janlelis/code"
13
13
  gem.license = "MIT"
14
14
 
@@ -16,8 +16,9 @@ Gem::Specification.new do |gem|
16
16
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
18
  gem.require_paths = ['lib']
19
+ gem.metadata = { "rubygems_mfa_required" => "true" }
19
20
 
20
- gem.required_ruby_version = "~> 2.0"
21
- gem.add_dependency "method_source", "~> 0.9"
21
+ gem.required_ruby_version = ">= 2.0", "< 4.0"
22
+ gem.add_dependency "method_source", ">= 0.9", "< 2.0"
22
23
  gem.add_dependency "coderay", "~> 1.1"
23
24
  end
data/lib/code/version.rb CHANGED
@@ -1,5 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Code
2
- VERSION = "0.9.2".freeze
4
+ VERSION = "0.9.4"
3
5
  end
4
-
5
-
data/lib/code.rb CHANGED
@@ -15,7 +15,12 @@ module Code
15
15
 
16
16
  # API for end user
17
17
  def self.for(object = self, method_name)
18
- m = object.method(method_name)
18
+ if method_name.is_a?(Method) || method_name.is_a?(UnboundMethod)
19
+ m = method_name
20
+ else
21
+ m = object.method(method_name)
22
+ end
23
+
19
24
  begin
20
25
  from_ruby(m)
21
26
  rescue MethodSource::SourceNotFoundError
metadata CHANGED
@@ -1,29 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: code
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Lelis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-27 00:00:00.000000000 Z
11
+ date: 2022-12-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: method_source
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0.9'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '2.0'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
25
28
  - !ruby/object:Gem::Version
26
29
  version: '0.9'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '2.0'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: coderay
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -38,8 +44,10 @@ dependencies:
38
44
  - - "~>"
39
45
  - !ruby/object:Gem::Version
40
46
  version: '1.1'
41
- description: Displays a method's code (from source or docs).
42
- email: mail@janlelis.de
47
+ description: Displays a method's code (from source or docs). Supports native C source
48
+ when core_docs gem is available
49
+ email:
50
+ - hi@ruby.consulting
43
51
  executables: []
44
52
  extensions: []
45
53
  extra_rdoc_files: []
@@ -55,24 +63,27 @@ files:
55
63
  homepage: https://github.com/janlelis/code
56
64
  licenses:
57
65
  - MIT
58
- metadata: {}
66
+ metadata:
67
+ rubygems_mfa_required: 'true'
59
68
  post_install_message:
60
69
  rdoc_options: []
61
70
  require_paths:
62
71
  - lib
63
72
  required_ruby_version: !ruby/object:Gem::Requirement
64
73
  requirements:
65
- - - "~>"
74
+ - - ">="
66
75
  - !ruby/object:Gem::Version
67
76
  version: '2.0'
77
+ - - "<"
78
+ - !ruby/object:Gem::Version
79
+ version: '4.0'
68
80
  required_rubygems_version: !ruby/object:Gem::Requirement
69
81
  requirements:
70
82
  - - ">="
71
83
  - !ruby/object:Gem::Version
72
84
  version: '0'
73
85
  requirements: []
74
- rubyforge_project:
75
- rubygems_version: 2.6.13
86
+ rubygems_version: 3.4.1
76
87
  signing_key:
77
88
  specification_version: 4
78
89
  summary: Displays a method's code.