DRY initialization

Instead of writing this:

    def initialize(host, port, options = nil)
      @host = host;
      @port = port;
      @options = options;
    end


wouldn’t it be nicer to be able to write something approximately like this:

    def initialize(host, port, options = nil)
      initialize_variables
    end


or even better yet, simply this:

    initialize_variables(host, port, options = nil)

Explore posts in the same categories: Rails, Ruby

Comment:

You must be logged in to post a comment.