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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2aa745b489b0558f4dade17e2dfcbe97980f92b3
4
- data.tar.gz: d26ec5caecc74d061bfd6e27a380ff3ec0026112
3
+ metadata.gz: 4031e503c170020bf3d74954e9cf1a79cafcf062
4
+ data.tar.gz: 9cbefc79965d1f6eebe42d1ad8ebe3716d3e6764
5
5
  SHA512:
6
- metadata.gz: 335e9339d1daab792155efcf8226517137c6a762e58dbac2a223e133e6ee4bc8fe2ee2f78cd70d518f321e317a1f63d075f6df10857f7e9e4cb8ef61b63a8407
7
- data.tar.gz: abe6c59ed36323f98614668f79667e8433604530bd232d91ca82154e678a1e8b66ae3b6c5195f4c66ff08c29f1cc25faecc9f59115c435a3ee68ca0003570ac5
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
- instance_m = subject.instance_methods(false).concat(subject.private_instance_methods(false))
82
- klass_m = subject.methods(false).concat(subject.private_methods(false)) - Object.methods
83
- methods.concat instance_m.map { |method| InstanceMethod.new("#{subject.name}##{method}", context: subject) }
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 }
@@ -55,7 +55,7 @@ module MarkdownRubyDocumentation
55
55
  if (v = when_start_and_end(comment_string))
56
56
  v
57
57
  elsif (x = when_only_start(comment_string))
58
- x << "[//]: # (This method has no mark_end)"
58
+ x
59
59
  else
60
60
  ""
61
61
  end
@@ -1,3 +1,3 @@
1
1
  module MarkdownRubyDocumentation
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  end
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.1
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 00:00:00.000000000 Z
11
+ date: 2016-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: method_source