markdown_ruby_documentation 0.21.2 → 0.22.0

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
2
  SHA1:
3
- metadata.gz: e6c40493a53d927c12ac286744b7b4a8774ee5fb
4
- data.tar.gz: b6b7c05a3a6cbaf5b414acfabb9199410be62dc8
3
+ metadata.gz: 02c84572f9faa898b291c1a78d07365a2fc7fdaa
4
+ data.tar.gz: 190f670308fb4a9de7ee641aa78a1fd428e63bab
5
5
  SHA512:
6
- metadata.gz: d612add5f12815fc62215d2c42c6b159b4b2fa8e329c5c4aa955d031b1e1bd964f5643a4c291bf475353515b28f0075f94039b901daf1658bda4efa4499b36f6
7
- data.tar.gz: 3daf791211a22e468e967548c98d245affc1104663cb6a8a8065016774d8eaa16d0d8e77fdeb94cc8cff0ee3812749a465a7183a79f01776f3731f099d3220d3
6
+ metadata.gz: aca3be20490229c8a6351b1b639787c9ec12c02eccbf91cb08e71f760210f04773a57bec7a4e2dfab4af424531e38fa2ecff0df7a3c5a2a702d485d8e59c2ca0
7
+ data.tar.gz: a6ba7cb14f17136e43282812d65f5ee66023f88fa6a6ca6332adac198ea5b8f6468e070e75723a07b1dc559a18b0d01ac27ed68da13e4761341b78743c7a4820
@@ -40,28 +40,34 @@ module MarkdownRubyDocumentation
40
40
  end
41
41
 
42
42
  def instances_methods
43
- @instance_methods ||= item_types.delete("MarkdownRubyDocumentation::InstanceMethod") || {}
44
- @instance_methods.map do |name, hash|
45
- %[## #{name.to_s.titleize}\n#{hash[:text]}] unless hash[:text].blank?
46
- end.join("\n\n")
43
+ @instance_methods ||= method_presenters("MarkdownRubyDocumentation::InstanceMethod")
47
44
  end
48
45
 
49
46
  def class_methods
50
- @class_methods ||= item_types.delete("MarkdownRubyDocumentation::ClassMethod") || {}
51
- @class_methods.map do |name, hash|
52
- %[## #{name.to_s.titleize}\n#{hash[:text]}] unless hash[:text].blank?
53
- end.join("\n\n")
47
+ @class_methods ||= method_presenters("MarkdownRubyDocumentation::ClassMethod")
54
48
  end
55
49
 
56
50
  def null_methods
57
- @null_methods ||= item_types.delete("MarkdownRubyDocumentation::NullMethod") || {}
58
- md = @null_methods.map do |name, hash|
59
- %[### #{name.to_s.titleize}\n#{hash[:text]}] unless hash[:text].blank?
51
+ @null_methods ||= begin
52
+ md = method_presenters("MarkdownRubyDocumentation::NullMethod", "###")
53
+ if md.blank?
54
+ ""
55
+ else
56
+ "\n## Reference Values\n" << md
57
+ end
58
+ end
59
+ end
60
+
61
+ def method_presenters(type, heading="##")
62
+ type_methods = item_types.delete(type) || []
63
+ order_by_location(type_methods).map do |(name, hash)|
64
+ %[#{heading} #{name.to_s.titleize}\n#{hash[:text]}] unless hash[:text].blank?
60
65
  end.join("\n\n")
61
- if md.blank?
62
- ""
63
- else
64
- "\n## Reference Values\n" << md
66
+ end
67
+
68
+ def order_by_location(items)
69
+ items.sort_by do |(_, hash)|
70
+ hash[:method_object].source_location
65
71
  end
66
72
  end
67
73
 
@@ -1,3 +1,3 @@
1
1
  module MarkdownRubyDocumentation
2
- VERSION = "0.21.2"
2
+ VERSION = "0.22.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: markdown_ruby_documentation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.21.2
4
+ version: 0.22.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dustin Zeisler