Module: Rundoc
- Extended by:
- Rundoc
- Included in:
- Rundoc
- Defined in:
- lib/rundoc.rb,
lib/rundoc/cli.rb,
lib/rundoc/parser.rb,
lib/rundoc/version.rb,
lib/rundoc/peg_parser.rb,
lib/rundoc/peg_parser.rb,
lib/rundoc/code_command.rb,
lib/rundoc/code_section.rb,
lib/rundoc/code_command/raw.rb,
lib/rundoc/code_command/pipe.rb,
lib/rundoc/context/execution.rb,
lib/rundoc/code_command/write.rb,
lib/rundoc/cli_argument_parser.rb,
lib/rundoc/context/after_build.rb,
lib/rundoc/code_command/rundoc_command.rb,
lib/rundoc/code_command/no_such_command.rb
Defined Under Namespace
Modules: Context
Classes: CLI, CLIArgumentParser, CodeCommand, CodeSection, Parser, PegParser, PegTransformer
Constant Summary
collapse
- VERSION =
"3.0.0"
Instance Attribute Summary collapse
Instance Method Summary
collapse
Instance Attribute Details
#project_root ⇒ Object
Returns the value of attribute project_root.
79
80
81
|
# File 'lib/rundoc.rb', line 79
def project_root
@project_root
end
|
Instance Method Details
#after_build(&block) ⇒ Object
56
57
58
59
|
# File 'lib/rundoc.rb', line 56
def after_build(&block)
@after_build_block ||= []
@after_build_block << block
end
|
#code_command(keyword) ⇒ Object
35
36
37
|
# File 'lib/rundoc.rb', line 35
def code_command(keyword)
code_lookup[:"#{keyword}"]
end
|
#code_command_from_keyword(keyword, args) ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/rundoc.rb', line 8
def code_command_from_keyword(keyword, args)
klass = code_command(keyword.to_sym) || Rundoc::CodeCommand::NoSuchCommand
original_args = args.dup
if args.is_a?(Array) && args.last.is_a?(Hash)
kwargs = args.pop
cc = klass.new(*args, **kwargs)
elsif args.is_a?(Hash)
cc = klass.new(**args)
else
cc = klass.new(*args)
end
cc.original_args = original_args
cc.keyword = keyword
cc
rescue ArgumentError => e
raise ArgumentError, "Wrong method signature for #{keyword} with arguments: #{original_args.inspect}, error:\n #{e.message}"
end
|
#code_lookup ⇒ Object
31
32
33
|
# File 'lib/rundoc.rb', line 31
def code_lookup
@code_lookup ||= {}
end
|
#config {|_self| ... } ⇒ Object
61
62
63
|
# File 'lib/rundoc.rb', line 61
def config
yield self
end
|
47
48
49
|
# File 'lib/rundoc.rb', line 47
def configure(&block)
yield self
end
|
#filter_sensitive(sensitive) ⇒ Object
65
66
67
68
69
|
# File 'lib/rundoc.rb', line 65
def filter_sensitive(sensitive)
raise "Expecting #{sensitive} to be a hash" unless sensitive.is_a?(Hash)
@sensitive ||= {}
@sensitive.merge!(sensitive)
end
|
#known_commands ⇒ Object
39
40
41
|
# File 'lib/rundoc.rb', line 39
def known_commands
code_lookup.keys
end
|
#parser_options ⇒ Object
27
28
29
|
# File 'lib/rundoc.rb', line 27
def parser_options
@parser_options ||= {}
end
|
#register_code_command(keyword, klass) ⇒ Object
43
44
45
|
# File 'lib/rundoc.rb', line 43
def register_code_command(keyword, klass)
code_lookup[keyword] = klass
end
|
#run_after_build(context) ⇒ Object
51
52
53
54
|
# File 'lib/rundoc.rb', line 51
def run_after_build(context)
@after_build_block ||= []
@after_build_block.each { |block| block.call(context) }
end
|
#sanitize!(doc) ⇒ Object
71
72
73
74
75
76
77
|
# File 'lib/rundoc.rb', line 71
def sanitize!(doc)
return doc if @sensitive.nil?
@sensitive.each do |sensitive, replace|
doc.gsub!(sensitive.to_s, replace)
end
doc
end
|