module GdatastoreMapper::Base::ClassMethods

Public Instance Methods

attr_accessor(*vars) click to toggle source
Calls superclass method
# File lib/gdatastore_mapper/base.rb, line 29
def attr_accessor(*vars)
  @attributes ||= []
  @attributes.concat vars
  super
end
attributes() click to toggle source
# File lib/gdatastore_mapper/base.rb, line 35
def attributes
  @attributes.reject do |attr|
    [:id, :created_at, :updated_at].include? attr
  end
end
from_entity(entity) click to toggle source
# File lib/gdatastore_mapper/base.rb, line 41
def from_entity entity
  record = self.new
  record.id = entity.key.id
  entity.properties.to_hash.each do |name, value|
    record.send "#{name}=", value if record.respond_to? "#{name}="
  end
  record
end