I thought this should work:
def setMethod(method)
if method in @@methods
... do something
end
end
But I keep getting keyword error for in
Try this, assuming @@methods is an array:
if @@methods.include?(method)
# ...
end
for method in @@methods or better yet @@methods.each do |method|
inin Ruby. Use@@methods.include? methodinstead. See, for example, stackoverflow.com/questions/1986386/…. Sometimes the way we expect a language should work isn't the way it works. ;)inkeyword and claims to try to 'give ease to ruby developers who want to write coffeescript'inkeyword that can be used forforloops, but it is hardly used.