title: How do I use the Enumerable mixin in my class?
body: <p>I have a class called <code>Note</code>, which includes an instance variable called <code>time_spent</code>. I want to be able to do something like this:</p>
  
  <pre><code>current_user.notes.inject{|total_time_spent,note| total_time_spent + note.time_spent}
  </code></pre>
  
  <p>Is this possible by mixing in the <a href="http://ruby-doc.org/core-1.9.2/Enumerable.html" rel="noreferrer">Enumerable module</a>? I know you are supposed to do add <code>include Enumerable</code> to the class and then define an <code>each</code> method, but should the each method be a class or instance method? What goes in the <code>each</code> method?</p>
  
  <p>I'm using Ruby 1.9.2</p>