Skip to content

Instantly share code, notes, and snippets.

@brainopia
Created May 30, 2012 11:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brainopia/2835713 to your computer and use it in GitHub Desktop.
Save brainopia/2835713 to your computer and use it in GitHub Desktop.
module A
# prefer when there are less than three class methods
# and there are instance methods
def self.boo
end
def self.soo
end
def fuuu
end
end
module B
# prefer when there are three or more class methods
# and there are instance methods
class << self
def boo
end
def soo
end
def moo
end
end
def fuuu
end
end
module C
# prefer when there are no private/protected
# and there are no instance methods
module_function
def boo
end
def moo
end
end
module D
# prefer when there are private/protected scopes
# and there are no instance methods
extend self
def boo
end
private
def moo
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment