Skip to content

Instantly share code, notes, and snippets.

@matsumonkie
Created June 14, 2014 21:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matsumonkie/97191cabd4f5851c34c0 to your computer and use it in GitHub Desktop.
Save matsumonkie/97191cabd4f5851c34c0 to your computer and use it in GitHub Desktop.
registry pattern
module Registry
class << self
def logger
# some default logger...
end
def server
# some server
end
end
end
class MyHttpApplication
def initialize(opts = {})
@logger = opts.fetch(:logger) { Registry.logger() }
@server = opts.fetch(:server) { Registry.server() }
end
end
MyHttpApplication.new(server: Unicorn.new()).main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment