markdown_ruby_documentation 0.4.1 → 0.4.2
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/lib/markdown_ruby_documentation/class_level_comment.rb +1 -1
- data/lib/markdown_ruby_documentation/constants_presenter.rb +6 -1
- data/lib/markdown_ruby_documentation/generate.rb +5 -3
- data/lib/markdown_ruby_documentation/method.rb +7 -6
- data/lib/markdown_ruby_documentation/template_parser.rb +0 -1
- data/lib/markdown_ruby_documentation/template_parser/parsing.rb +1 -1
- data/lib/markdown_ruby_documentation/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4031e503c170020bf3d74954e9cf1a79cafcf062
|
4
|
+
data.tar.gz: 9cbefc79965d1f6eebe42d1ad8ebe3716d3e6764
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e9da2e6cc72c1cccfaf46e0aa371ab1f7ab516b6b6b851abe9ccc35b0da79224e90aeb1acbafd150e457bf31e467b89aefaa9530f1284d9f52710e08ed2a9fd
|
7
|
+
data.tar.gz: 1711691a6813ba02240aae8354b2fd3850c63deeb1c9fb5f1aae9140aca9b36771c484622f382584b2ab6bc97ff262f7a5050f3cc6fbba66ea7c021fb1a4e619
|
@@ -8,7 +8,7 @@ module MarkdownRubyDocumentation
|
|
8
8
|
|
9
9
|
def call(interface)
|
10
10
|
_method = interface.reject do |_, meth|
|
11
|
-
meth[:method_object].is_a?(NullMethod)
|
11
|
+
meth[:method_object].is_a?(NullMethod) || meth[:method_object].visibility != :native
|
12
12
|
end.first
|
13
13
|
if _method
|
14
14
|
filename, lineno = _method[1][:method_object].to_proc.source_location
|
@@ -9,6 +9,7 @@ module MarkdownRubyDocumentation
|
|
9
9
|
|
10
10
|
def call(interface)
|
11
11
|
constants.each do |const_name, value|
|
12
|
+
next if value.nil?
|
12
13
|
interface[const_name] = { text: value, method_object: Method.create("#{subject.name}::#{const_name}", null_method: true) }
|
13
14
|
end
|
14
15
|
interface
|
@@ -21,7 +22,11 @@ module MarkdownRubyDocumentation
|
|
21
22
|
when String
|
22
23
|
value.inspect
|
23
24
|
else
|
24
|
-
value
|
25
|
+
if value.to_s =~ /#<[a-zA-Z0-9\-_:]+:[0-9xa-f]+>/
|
26
|
+
nil
|
27
|
+
else
|
28
|
+
value
|
29
|
+
end
|
25
30
|
end
|
26
31
|
end
|
27
32
|
|
@@ -78,9 +78,11 @@ module MarkdownRubyDocumentation
|
|
78
78
|
end
|
79
79
|
|
80
80
|
def all_instance_and_class_methods(methods, subject)
|
81
|
-
|
82
|
-
|
83
|
-
|
81
|
+
native_instance_methods = (subject.instance_methods(false) - Object.instance_methods(false)).concat(subject.private_instance_methods(false) - Object.private_instance_methods(false))
|
82
|
+
super_instance_methods = (subject.instance_methods(true) - Object.instance_methods(true)).concat(subject.private_instance_methods(true) - Object.private_instance_methods(true)) - native_instance_methods
|
83
|
+
klass_m = subject.methods(false).concat(subject.private_methods(false)) - Object.methods
|
84
|
+
methods.concat super_instance_methods.reverse.map { |method| InstanceMethod.new("#{subject.name}##{method}", context: subject, visibility: :super) }
|
85
|
+
methods.concat native_instance_methods.map { |method| InstanceMethod.new("#{subject.name}##{method}", context: subject, visibility: :native) }
|
84
86
|
methods.concat klass_m.map { |method| ClassMethod.new("#{subject.name}.#{method}", context: subject) }
|
85
87
|
end
|
86
88
|
|
@@ -1,12 +1,13 @@
|
|
1
1
|
module MarkdownRubyDocumentation
|
2
2
|
class Method
|
3
3
|
InvalidMethodReference = Class.new(StandardError)
|
4
|
-
attr_reader :method_reference
|
4
|
+
attr_reader :method_reference, :visibility
|
5
5
|
protected :method_reference
|
6
6
|
|
7
|
-
def initialize(method_reference, context: Kernel)
|
7
|
+
def initialize(method_reference, context: Kernel, visibility: :public)
|
8
8
|
@method_reference = method_reference.to_s
|
9
9
|
@context = context
|
10
|
+
@visibility = visibility
|
10
11
|
end
|
11
12
|
|
12
13
|
# @param [String] method_reference
|
@@ -15,16 +16,16 @@ module MarkdownRubyDocumentation
|
|
15
16
|
# "Constant.class_method_name" class method on a specific constant.
|
16
17
|
# "SomeClass#instance_method_name" an instance method on a specific constant.
|
17
18
|
# "#instance_method_name" an instance method in the current scope.
|
18
|
-
def self.create(method_reference, null_method: false, context: Kernel)
|
19
|
+
def self.create(method_reference, null_method: false, context: Kernel, visibility: :public)
|
19
20
|
return method_reference if method_reference.is_a?(Method)
|
20
21
|
case method_reference
|
21
22
|
when InstanceMethod
|
22
|
-
InstanceMethod.new(method_reference, context: context)
|
23
|
+
InstanceMethod.new(method_reference, context: context, visibility: visibility)
|
23
24
|
when ClassMethod
|
24
|
-
ClassMethod.new(method_reference, context: context)
|
25
|
+
ClassMethod.new(method_reference, context: context, visibility: visibility)
|
25
26
|
else
|
26
27
|
if null_method
|
27
|
-
NullMethod.new(method_reference, context: context)
|
28
|
+
NullMethod.new(method_reference, context: context, visibility: visibility)
|
28
29
|
else
|
29
30
|
raise InvalidMethodReference, "method_reference is formatted incorrectly: '#{method_reference}'"
|
30
31
|
end
|
@@ -54,7 +54,6 @@ module MarkdownRubyDocumentation
|
|
54
54
|
rescue MethodSource::SourceNotFoundError => e
|
55
55
|
@current_method = nil
|
56
56
|
value = false
|
57
|
-
puts e.message unless IGNORE_METHODS.any? { |im| e.message.include? im }
|
58
57
|
end
|
59
58
|
if value
|
60
59
|
hash[method.name] = { text: value, method_object: method }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: markdown_ruby_documentation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dustin Zeisler
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: method_source
|