Skip to content

Instantly share code, notes, and snippets.

@sbellware
Last active August 29, 2015 14:02
Show Gist options
  • Select an option

  • Save sbellware/9feec4cd74e563c36f8c to your computer and use it in GitHub Desktop.

Select an option

Save sbellware/9feec4cd74e563c36f8c to your computer and use it in GitHub Desktop.
Initializers only record parameters
def Connection
def initialize(connection_string)
@connection_string = connection_string
end
def self.connect(connection_string)
instance = build connection_string
instance.connect
instance
end
def self.build(connection_string)
instance = new connection_string
instance.logger = configure_logger
instance
end
def connect
# ...
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment