Module: Twitter::ModelMixin

Included in:
Message, RateLimitStatus, Status, User
Defined in:
lib/twitter/model.rb

Overview

Mixin module for model classes. Includes generic class methods like unmarshal.

To create a new model that includes this mixin’s features simply:

class NewModel
  include Twitter::ModelMixin
end

This mixin module automatically includes Twitter::ClassUtilMixin features.

The contract for models to use this mixin correctly is that the class including this mixin must provide an class method named attributes that will return an Array of attribute symbols that will be checked in #eql? override method. The following would be sufficient:

def self.attributes; @@ATTRIBUTES; end

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object

:nodoc:



21
22
23
24
25
# File 'lib/twitter/model.rb', line 21

def self.included(base) #:nodoc:
  base.send(:include, Twitter::ClassUtilMixin)
  base.send(:include, InstanceMethods)
  base.extend(ClassMethods)
end