class YARD::Handlers::Ruby::ClassConditionHandler

end
end
def xyz; end
# This method is ignored
if 0
class Foo
@example A simple class conditional
one branch (by evaluating the condition if possible).
Matches if/unless conditions inside classes and attempts to process only

def parse_condition

Returns:
  • (true, false, nil) - true if the condition can be definitely
def parse_condition
  condition = nil
  
  # Right now we can handle very simple unary conditions like:
  #   if true
  #   if false
  #   if 0
  #   if 100 (not 0)
  #   if defined? SOME_CONSTANT
  # 
  # The last case will do a lookup in the registry and then one
  # in the Ruby world (using eval).
  case statement.condition.type
  when :int
    condition = statement.condition[0] != "0"
  when :defined
    # defined? keyword used, let's see if we can look up the name
    # in the registry, then we'll try using Ruby's powers. eval() is not
    # *too* dangerous here since code is not actually executed.
    name = statement.condition[0].source
    obj = YARD::Registry.resolve(namespace, name, true)
    begin
      condition = true if obj || Object.instance_eval("defined? #{name}")
    rescue SyntaxError, NameError
      condition = false
    end
  when :var_ref
    var = statement.condition[0]
    if var == s(:kw, "true")
      condition = true
    elsif var == s(:kw, "false")
      condition = false
    end
  end
  
  # Invert an unless condition
  if statement.type == :unless || statement.type == :unless_mod
    condition = !condition if condition != nil
  end
  condition
end

def parse_else_block

def parse_else_block
  parse_block(statement.else_block) if statement.else_block
end

def parse_then_block

def parse_then_block
  parse_block(statement.then_block)
end