Sha256: a6bca9973e061392436326f1d1c0690e1bda3ce4ba8b42656c6e21771c466b55
Contents?: true
Size: 879 Bytes
Versions: 16
Compression:
Stored size: 879 Bytes
Contents
class CMS::Type attr_accessor :name, :attributes, :options, :references include ActiveModel::Naming # using include instead of extend on purpose def parents ; [] end # quacks like a Module def initialize name, attributes, options = {} @name = name @attributes = attributes @options = options.symbolize_keys.merge(timestamps: true, indexes: true) @references = [] end def accessible_attributes attributes end def attributes_with_index attributes.select { |a| a.has_index? || (a.reference? && options[:indexes]) } end def orderable_attributes attributes.select(&:orderable?) end def file_attributes attributes.select(&:file?) end def orderable? !!order_attribute end def order_attribute orderable_attributes.first end def to_s name end def subject options[:subject] || name end end
Version data entries
16 entries across 16 versions & 1 rubygems