이 코드를 실행 중이지만 오류가 발생합니다. 여기루비 오류 : 잘못된 인수 수 (1은 0) (ArgumentError)
코드 : -
class Text
def post(success, error)
if authenticate?(@user, @password)
success.call
else
erro.call
end
end
end
text = Text.new('Ruby Bits!')
success = ->{ puts "Sent!"}
error = ->{ raise 'Auth error'}
text.post(success,error)
알려주세요. 이 문제를 해결하는 방법?
'이후 post' 메소드 정의가 두 개의 매개 변수, 당신 ' d는'post'에 두 개의 인수를 전달해야합니다 :'test.post (success, error)' – Surya
나는 시험해 보았다. 이 오류는 제거되지 않습니다. 동일한 오류 표시 – test
arg "Ruby Bits!"를 전달 중입니다. 'Text'의 이니셜 라이저로 보내지 만 인자를 취하지 않습니다. – jordanm