PDA

View Full Version : [SOLVED] Ruby and defining the ! operator



_niai
October 27th, 2012, 06:03 PM
Hello. I am taking a Ruby class and I have a homework that I can't solve on my own. It involves writing several classes with specific methods and the part that is giving me trouble is a method that must be called in this way:



ClassName.method_name(argument) & ClassName.method_name(argument)
ClassName.method_name(argument) | ClassName.method.name(argument)
!ClassName.method_name(argument)
I did the first and the second but when I try to implement the third one it gives me 'syntax error' or 'wrong number of arguments' or something equally frustrating in any combination of "self", "!", "(argument)", "." and intervals I could think of. I've been trying to make this work or find an example with a similar syntax for a couple of hours and I am obviously stuck so any help will be much appreciated.