lib/yard/handlers/ruby/legacy/class_condition_handler.rb in yard-0.9.5 vs lib/yard/handlers/ruby/legacy/class_condition_handler.rb in yard-0.9.6
- old
+ new
@@ -1,14 +1,15 @@
+# frozen_string_literal: true
# (see Ruby::ClassConditionHandler)
# @since 0.5.4
class YARD::Handlers::Ruby::Legacy::ClassConditionHandler < YARD::Handlers::Ruby::Legacy::Base
namespace_only
handles TkIF, TkELSIF, TkUNLESS
process do
condition = parse_condition
- if condition == nil
+ if condition.nil?
# Parse both blocks if we're unsure of the condition
parse_then_block
parse_else_block
elsif condition
parse_then_block
@@ -56,11 +57,11 @@
when "false"
condition = false
end
if TkUNLESS === statement.tokens.first
- condition = !condition if condition != nil
+ condition = !condition unless condition.nil?
end
condition
end
# @since 0.5.5
@@ -71,13 +72,12 @@
# @since 0.5.5
def parse_else_block
return unless statement.block
stmtlist = YARD::Parser::Ruby::Legacy::StatementList
stmtlist.new(statement.block).each do |stmt|
- if TkELSE === stmt.tokens.first
- push_state(:visibility => visibility) do
- parser.process(stmtlist.new(stmt.block))
- end
+ next unless TkELSE === stmt.tokens.first
+ push_state(:visibility => visibility) do
+ parser.process(stmtlist.new(stmt.block))
end
end
end
-end
\ No newline at end of file
+end