Class: YARD::Amp::LegacyOptionHandler
Constant Summary
collapse
- MATCH =
/(opt|add_opt)\(?\s*(.*)\s*\)?\s*/
Instance Method Summary
collapse
#attach_metadata
#clean_string, #construct_docstring, #parse_hash, #split_by_comma_smart
Instance Method Details
#parse_parameters(params) ⇒ Object
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
# File 'lib/yard-amp/legacy_handler.rb', line 101
def parse_parameters(params)
name = clean_string(params.first)
description = clean_string(params[1])
option = OptionObject.new(owner, name, description)
if params[2..-1]
reg = /(.*?)\s*=>\s*([^,]*)/
params[2..-1].each do |param|
if param =~ reg
option.options[clean_string($1)] = clean_string $2
end
end
end
option.docstring = statement.
option
end
|
#process ⇒ Object
93
94
95
96
97
98
99
|
# File 'lib/yard-amp/legacy_handler.rb', line 93
def process
return unless super
params = split_by_comma_smart(statement.tokens.to_s[MATCH, 2]).map {|x| clean_string(x.strip)}
option = parse_parameters(params)
owner[:amp_data][:options] ||= []
owner[:amp_data][:options] << option
end
|