Skip to content

Instantly share code, notes, and snippets.

@emiltin
Created August 8, 2010 00:17
Show Gist options
  • Select an option

  • Save emiltin/513382 to your computer and use it in GitHub Desktop.

Select an option

Save emiltin/513382 to your computer and use it in GitHub Desktop.
class Integer
def show_divisors *a
info = a.map { |n| "is #{'not ' unless self%n==0}dividable by #{n}" }.join ' and '
puts "The value #{self} #{info}."
end
end
1.upto(10) { |x| x.show_divisors 3,5 }
1.upto(10) { |x| x.show_divisors 2,4,7 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment