Skip to content

Instantly share code, notes, and snippets.

@pbalduino
Created October 22, 2010 16:31
Show Gist options
  • Save pbalduino/640898 to your computer and use it in GitHub Desktop.
Save pbalduino/640898 to your computer and use it in GitHub Desktop.
1, 2, 3, pim! 5, 6, 7, pim!
class Integer
def multiplo_de_quatro?
self % 4 == 0
end
def pim!
multiplo_de_quatro? ? "pim!" : "#{self}"
end
end
(1..20).each {|numero| puts numero.pim! }
puts 32768.pim! # pim!
puts 17.pim! # 17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment