Sha256: cd1a273acb6a942d065361d495071c447f1592cad38183212defa1c0fc8cbf67
Contents?: true
Size: 1.09 KB
Versions: 1
Compression:
Stored size: 1.09 KB
Contents
# frozen_string_literal: true # Handles 'private', 'protected', and 'public' calls. class YARD::Handlers::Ruby::VisibilityHandler < YARD::Handlers::Ruby::Base include YARD::Handlers::Ruby::DecoratorHandlerMethods handles method_call(:private) handles method_call(:protected) handles method_call(:public) namespace_only process do return if (ident = statement.jump(:ident)) == statement case statement.type when :var_ref, :vcall self.visibility = ident.first.to_sym when :command if RUBY_VERSION >= '3.' && is_attribute_method?(statement.parameters.first) parse_block(statement.parameters.first, visibility: ident.first.to_sym) return end process_decorator do |method| method.visibility = ident.first if method.respond_to? :visibility= end when :fcall process_decorator do |method| method.visibility = ident.first if method.respond_to? :visibility= end end end def is_attribute_method?(node) node.type == :command && node.jump(:ident).first.to_s =~ /^attr_(accessor|writer|reader)$/ end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
yard-0.9.37 | lib/yard/handlers/ruby/visibility_handler.rb |