Sha256: 0c57a622daa4cb56faec45fa3cab437a27e44d4a68cde63dd69a580338510bc3
Contents?: true
Size: 964 Bytes
Versions: 2
Compression:
Stored size: 964 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 order_options CMS::Template.inject_options(order_attribute.options) end def to_s name end def subject options[:subject] || name end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
honey-cms-0.3.10 | lib/cms/type.rb |
honey-cms-0.3.9 | lib/cms/type.rb |