Skip to content

Instantly share code, notes, and snippets.

@HotFusionMan
Created January 14, 2011 15:51
Show Gist options
  • Save HotFusionMan/779769 to your computer and use it in GitHub Desktop.
Save HotFusionMan/779769 to your computer and use it in GitHub Desktop.
How to add a "class-level" method to an existing module.
module PerfectBitsMath
def number_of_squares_in_interval( m, n )
1
end
end
module Math
extend PerfectBitsMath
end
puts 'The next line should read "true":'
puts Math.number_of_squares_in_interval( 4, 4 ) == 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment