title: Create instance of a new class object, from within separate class object
body: <p>Is it possible in Ruby to instantiate another object of a different class using a class method?</p>
  
  <p>I have spent a lot of time to no avail researching Google, the Ruby docs, and Stack Overflow, for an answer to my query, so I am posting this question as a last resort.</p>
  
  <p>Two classes, <strong>User</strong>, and <strong>Blog</strong>. In <strong>User</strong> below I am trying to create a new instance of an object for <strong>Blog</strong>, and carry over some attributes.</p>
  
  <p>In class <strong>User</strong> there are 2 methods; </p>
  
  <pre><code>class User
    attr_accessor :blogs, :username
  
    def initialize(username)
      self.username = username
      self.blogs = []
    end
  
    def add_blog(date, text)
      self.blogs &lt;&lt; [Date.parse(date),text]
      new_blog = [Date.parse(date),text]
      Blog.new(@username,date,text)
    end
  end
  </code></pre>
  
  <p>Using the above <strong>add_blog</strong> I would like to initialize &amp; send a new object to the Blog class.</p>
  
  <pre><code>class Blog
    attr_accessor :text, :date, :user
    def initialize(user,date,text)
      user = user
      date = date
      text = text
    end
  end
  </code></pre>