Module: TimestampAPI::ModelAttributes::ClassMethods

Defined in:
lib/timestamp_api/model_attributes.rb

Instance Method Summary collapse

Instance Method Details

#has_attributes(*attributes) ⇒ Object



19
20
21
22
23
24
# File 'lib/timestamp_api/model_attributes.rb', line 19

def has_attributes(*attributes)
  # Add those attributes to the list of attributes for this class
  self.class_variable_set(:@@attributes, self.class_variable_get(:@@attributes) + attributes)
  # Define getters for those attributes
  self.send(:attr_accessor, *attributes)
end