markdown_ruby_documentation 0.22.1 → 0.22.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56a7bd11d65604831458ea29a015cd9d36ef4d96
|
4
|
+
data.tar.gz: e881c7e5bc63f6916c3ea16950fffbb008384da7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8152ac56862acd3c0eb532cba93f294316251dd7e95349899e797ed3eded08c4b31d7a0a7ffb8c36e115ddff082bfad0536b30a6379d1c1f31851384aa8ee90
|
7
|
+
data.tar.gz: 94ac6b99821dccef78b13c16d2d10da7995a60030211500b3091dd6e4bd99a966dcf1486f6cdff2c3f704fd76951aa2b54b35faf174c98d98b9f8238e62a4669
|
@@ -50,40 +50,39 @@ module MarkdownRubyDocumentation
|
|
50
50
|
@parser ||= methods.each_with_object({}) do |method, hash|
|
51
51
|
begin
|
52
52
|
@current_method = method
|
53
|
-
value =
|
54
|
-
rescue MethodSource::SourceNotFoundError
|
53
|
+
value = compile_comment(method)
|
54
|
+
rescue MethodSource::SourceNotFoundError
|
55
55
|
@current_method = nil
|
56
56
|
value = false
|
57
57
|
end
|
58
|
-
if value
|
59
|
-
hash[method.name] = { text: value, method_object: method }
|
60
|
-
end
|
58
|
+
hash[method.name] = { text: value, method_object: method } if value
|
61
59
|
end
|
62
60
|
end
|
63
61
|
|
64
62
|
module CommentMacros
|
65
63
|
include Parsing
|
66
64
|
attr_accessor :output_object
|
67
|
-
# @param [String]
|
65
|
+
# @param [String] method_reference
|
68
66
|
# @example
|
69
67
|
# @return [String] of any comments proceeding a method def
|
70
|
-
def print_raw_comment(
|
71
|
-
strip_comment_hash(ruby_class_meth_comment(Method.create(
|
68
|
+
def print_raw_comment(method_reference)
|
69
|
+
strip_comment_hash(ruby_class_meth_comment(Method.create(method_reference, context: ruby_class)))
|
72
70
|
end
|
73
71
|
|
74
|
-
# @param [String]
|
72
|
+
# @param [String] method_reference
|
75
73
|
# @example
|
76
74
|
# @return [String]
|
77
|
-
def print_mark_doc_from(
|
78
|
-
method
|
79
|
-
|
75
|
+
def print_mark_doc_from(method_reference)
|
76
|
+
method = Method.create(method_reference, context: ruby_class)
|
77
|
+
comment = extract_dsl_comment(print_raw_comment(method_reference))
|
78
|
+
compile_comment(method, comment)
|
80
79
|
end
|
81
80
|
|
82
|
-
# @param [String]
|
81
|
+
# @param [String] method_reference
|
83
82
|
# @example
|
84
83
|
# @return [Object] anything that the evaluated method would return.
|
85
|
-
def eval_method(
|
86
|
-
case (method = Method.create(
|
84
|
+
def eval_method(method_reference=current_method)
|
85
|
+
case (method = Method.create(method_reference, context: ruby_class))
|
87
86
|
when ClassMethod
|
88
87
|
method.context.public_send(method.name)
|
89
88
|
when InstanceMethod
|
@@ -526,6 +525,10 @@ module MarkdownRubyDocumentation
|
|
526
525
|
end
|
527
526
|
source_code
|
528
527
|
end
|
528
|
+
|
529
|
+
def compile_comment(method, comment = extract_dsl_comment_from_method(method))
|
530
|
+
parse_erb(insert_method_name(strip_comment_hash(comment), method), method)
|
531
|
+
end
|
529
532
|
end
|
530
533
|
|
531
534
|
include CommentMacros
|
@@ -4,30 +4,30 @@ module MarkdownRubyDocumentation
|
|
4
4
|
def parse_erb(str, method)
|
5
5
|
filename, lineno = ruby_class_meth_source_location(method)
|
6
6
|
adjusted_lineno = (lineno - ruby_class_meth_comment(method).split("\n").count-1)
|
7
|
-
|
7
|
+
method.context.module_eval(<<-RUBY, __FILE__, __LINE__+1)
|
8
8
|
def self.get_binding
|
9
9
|
self.send(:binding)
|
10
10
|
end
|
11
11
|
RUBY
|
12
|
-
|
12
|
+
method.context.send(:define_singleton_method, :current_method) do
|
13
13
|
method
|
14
14
|
end
|
15
15
|
|
16
|
-
|
16
|
+
method.context.send(:define_singleton_method, :output_object) do
|
17
17
|
output_object
|
18
18
|
end
|
19
19
|
|
20
|
-
|
20
|
+
method.context.send(:define_singleton_method, :load_path) do
|
21
21
|
load_path
|
22
22
|
end
|
23
23
|
|
24
|
-
|
24
|
+
method.context.extend(CommentMacros)
|
25
25
|
|
26
26
|
erb = ERB.new(str, nil, "-")
|
27
27
|
|
28
28
|
erb.lineno = adjusted_lineno if erb.respond_to?(:lineno)
|
29
29
|
erb.filename = filename if erb.respond_to?(:filename)
|
30
|
-
erb.result(
|
30
|
+
erb.result(method.context.get_binding)
|
31
31
|
rescue => e
|
32
32
|
raise e.class, e.message, ["#{filename}:#{adjusted_lineno}:in `#{method.name}'", *e.backtrace]
|
33
33
|
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.22.
|
4
|
+
version: 0.22.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: 2018-04-
|
11
|
+
date: 2018-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: method_source
|