Sha256: 1a9022b00d44a99e68596ce029ad0a1c4b5f41f78c5c11b6ee7e85f4288cdbfc
Contents?: true
Size: 1.17 KB
Versions: 11
Compression:
Stored size: 1.17 KB
Contents
module Cms module Concerns module HasContentType # Adds ContentType information to the object. # @param [Hash] options # @option options [Symbol] :module The module name, same as would be passed to content_module() def has_content_type(options={}) include InstanceMethods extend ClassMethods if options[:module] content_module options[:module] end end # Used as a marker for finding classes that implement Content Types. module InstanceMethods end module ClassMethods # Returns the Cms::ContentType which provides information about the content. def content_type Cms::ContentType.new(name: self.name) end # Allows a content block to configure which module it will be placed in. # @param [Symbol] module_name (Optional) Sets value if provided. # @return [Symbol] module_name def content_module(module_name=nil) if module_name @module_name = module_name end if @module_name @module_name else :general end end end end end end
Version data entries
11 entries across 11 versions & 2 rubygems