lib/yard/handlers/ruby/legacy/mixin_handler.rb in yard-0.9.5 vs lib/yard/handlers/ruby/legacy/mixin_handler.rb in yard-0.9.6
- old
+ new
@@ -1,8 +1,9 @@
+# frozen_string_literal: true
# (see Ruby::MixinHandler)
class YARD::Handlers::Ruby::Legacy::MixinHandler < YARD::Handlers::Ruby::Legacy::Base
- handles /\Ainclude(\s|\()/
+ handles(/\Ainclude(\s|\()/)
namespace_only
process do
errors = []
statement.tokens[1..-1].to_s.split(/\s*,\s*/).reverse.each do |mixin|
@@ -12,21 +13,20 @@
rescue YARD::Parser::UndocumentableError => err
errors << err.message
end
end
- if errors.size > 0
+ unless errors.empty?
msg = errors.size == 1 ? ": #{errors[0]}" : "s: #{errors.join(", ")}"
raise YARD::Parser::UndocumentableError, "mixin#{msg} for class #{namespace.path}"
end
end
private
def process_mixin(mixin)
- unless mixmatch = mixin[/\A(#{NAMESPACEMATCH})/, 1]
- raise YARD::Parser::UndocumentableError
- end
+ mixmatch = mixin[/\A(#{NAMESPACEMATCH})/, 1]
+ raise YARD::Parser::UndocumentableError unless mixmatch
case obj = Proxy.new(namespace, mixmatch)
when ConstantObject # If a constant is included, use its value as the real object
obj = Proxy.new(namespace, obj.value, :module)
else