2014-12-31 3 views
-1

나는 루비를 배우고있다. 세 클래스가 있습니다. 스위치 케이스를 사용하여 첫 번째 클래스에서 다른 두 클래스의 메서드를 호출하려고합니다. 그러나 오류가 초기화되지 않은 상수가 점점.오류 : 초기화되지 않은 상수

def operation(operate) 
    case operate 
    when operate.class == Subtraction && operate.new_record? 
    puts "abc" 
    else 
    puts "Something Else" 
    end 
end 
+0

당신이 어떤 오류를받을 :

class MainClass < Subtraction def operation(operate) case operate when Subtraction.new puts "abc" end end end 

+0

초기화되지 않은 상수 오류 – Anonymous

답변

0

다음 코드를 시도?