First page Back Continue Last page Overview Graphics
Ruby: Idioms Galore
Methods that end in '?' conventionally answer a yes/no question:
array.empty?
shopping_list.include? 'eggs'
Methods that end in '!' conventionally mutate the calling object (a danger mnemonic):
foo = 'foo'
bar = foo.swapcase
foo.swapcase!