Sha256: fd13f75c7bce66927ee1f8693d0dadf88632609dc99262613d35eaa96f30d515
Contents?: true
Size: 1.02 KB
Versions: 13
Compression:
Stored size: 1.02 KB
Contents
class ForwardableDefDelegatorsHandler < YARD::Handlers::Ruby::Base handles method_call(:def_delegators) namespace_only def process params = validated_attribute_names(statement.parameters(false)) accessor = params.shift params.each do |param| object = YARD::CodeObjects::MethodObject.new(namespace, param) object.docstring = "Forwarded to +#{accessor}+" end end protected # Strips out any non-essential arguments from the attr statement. # # @param [Array<Parser::Ruby::AstNode>] params a list of the parameters # in the attr call. # @return [Array<String>] the validated attribute names # @raise [Parser::UndocumentableError] if the arguments are not valid. def validated_attribute_names(params) params.map do |obj| case obj.type when :symbol_literal obj.jump(:ident, :op, :kw, :const).source when :string_literal obj.jump(:string_content).source else raise YARD::Parser::UndocumentableError, obj.source end end end end
Version data entries
13 entries across 13 versions & 1 rubygems