Sha256: 1c6f6b63c6067563cda0f5c1118cb139e83d40679b65598678b74945a7cbf108
Contents?: true
Size: 709 Bytes
Versions: 9
Compression:
Stored size: 709 Bytes
Contents
module Styleus # Provides a basic model, with attribute and # naming capabilities. # TODO: replace with ActiveModel::Model or something like that class Base extend ActiveModel::Naming include ActiveModel::AttributeMethods include ActiveModel::Serialization def initialize(attributes) @attributes = attributes end def id nil end # as implemented as in ActiveRecord def to_key key = self.id [key] if key end private def attribute(attr) @attributes[attr.to_sym] end class << self def with_attributes(*attribute_names) define_attribute_methods attribute_names.map(&:to_s) end end end end
Version data entries
9 entries across 9 versions & 1 rubygems