Skip to content

Instantly share code, notes, and snippets.

@emiltin
Created August 7, 2010 23:43
Show Gist options
  • Select an option

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

Select an option

Save emiltin/513331 to your computer and use it in GitHub Desktop.
class Integer
def divisable? v,b
"#{v%b==0 ? '' : 'not '}dividable by #{b}"
end
def show_divisors
puts "The value #{self} is #{divisable? self,3} and is #{divisable? self,5}."
end
end
1.upto(100) { |x| x.show_divisors }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment