Sha256: 2362729d7b0a07a70c33e0c80fa9c64ba6bb0a01a0f89848eff3de2c1148bf19
Contents?: true
Size: 929 Bytes
Versions: 22
Compression:
Stored size: 929 Bytes
Contents
module Alchemy module Site::Layout extend ActiveSupport::Concern SITE_DEFINITIONS_FILE = Rails.root.join('config/alchemy/site_layouts.yml') module ClassMethods # Returns the site layouts definition defined in +site_layouts.yml+ file # def definitions @definitions ||= read_site_definitions end private # Reads the site layouts definition file named +site_layouts.yml+ in +config/alchemy/+ # # It returns empty Array if no file is present # def read_site_definitions YAML.load_file(SITE_DEFINITIONS_FILE) || [] rescue Errno::ENOENT [] end end # Returns site's layout definition # def definition self.class.definitions.detect { |l| l['name'] == partial_name } end # Returns the name for the layout partial # def partial_name name.parameterize.underscore end end end
Version data entries
22 entries across 22 versions & 1 rubygems