Class: Yogurt::CodeGenerator::VariableDefinition

Inherits:
T::Struct
  • Object
show all
Extended by:
T::Sig
Includes:
Comparable
Defined in:
lib/yogurt/code_generator/variable_definition.rb

Instance Method Summary collapse

Instance Method Details

#<=>(other) ⇒ Object



22
23
24
25
26
27
28
29
30
# File 'lib/yogurt/code_generator/variable_definition.rb', line 22

def <=>(other)
  if optional? && !other.optional?
    1
  elsif other.optional? && !optional?
    -1
  else
    name <=> other.name
  end
end

#optional?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/yogurt/code_generator/variable_definition.rb', line 17

def optional?
  signature.start_with?("T.nilable")
end