module EffectiveRegions
Constants
- VERSION
Public Class Methods
config_keys()
click to toggle source
# File lib/effective_regions.rb, line 8 def self.config_keys [:regions_table_name, :ck_assets_table_name, :before_save_method] end
snippets()
click to toggle source
Returns a Snippet.new() for every class in the /app/effective/snippets/* directory
# File lib/effective_regions.rb, line 15 def self.snippets Rails.env.development? ? read_snippets : (@@snippets ||= read_snippets) end
templates()
click to toggle source
Returns a Template.new() for every class in the /app/effective/templates/* directory
# File lib/effective_regions.rb, line 20 def self.templates Rails.env.development? ? read_templates : (@@templates ||= read_templates) end
Private Class Methods
read_snippets()
click to toggle source
# File lib/effective_regions.rb, line 26 def self.read_snippets # Reversing here so the app's templates folder has precedence. files = ApplicationController.view_paths.map { |path| Dir["#{path}/effective/snippets/**"] }.flatten.reverse files.map do |file| snippet = File.basename(file) snippet = snippet[1...snippet.index('.') || snippet.length] # remove the _ and .html.haml "Effective::Snippets::#{snippet.try(:classify)}".constantize.new() end end
read_templates()
click to toggle source
# File lib/effective_regions.rb, line 39 def self.read_templates # Reversing here so the app's templates folder has precedence. files = ApplicationController.view_paths.map { |path| Dir["#{path}/effective/templates/**"] }.flatten.reverse files.map do |file| template = File.basename(file) template = template[1...template.index('.') || template.length] # remove the _ and .html.haml "Effective::Templates::#{template.try(:classify)}".constantize.new() end end