Class: YARD::Amp::ModernOptionHandler

Inherits:
ModernAmpCommandHandler show all
Defined in:
lib/yard-amp/modern_handler.rb

Instance Method Summary collapse

Methods inherited from ModernAmpCommandHandler

#attach_metadata

Methods included from ParsingHelpers

#clean_string, #construct_docstring, #parse_hash, #split_by_comma_smart

Instance Method Details

#parse_parameters(params) ⇒ Object



97
98
99
100
101
102
103
104
105
106
# File 'lib/yard-amp/modern_handler.rb', line 97

def parse_parameters(params)
  name = clean_string(params.first.source)
  description = clean_string(params[1].source)
  option = OptionObject.new(owner, name, description)
  if params[2]
    option.options = parse_hash(params[2])
  end
  option.docstring = statement.comments
  option
end

#processObject



89
90
91
92
93
94
95
# File 'lib/yard-amp/modern_handler.rb', line 89

def process
  return unless super
  params = statement.parameters
  option = parse_parameters(params)
  owner[:amp_data][:options] ||= []
  owner[:amp_data][:options] << option
end