Sha256: 7f5bf47c0d64a861de6aff1aeef64ea0bc62f229299541acc88ecd78759cef8c

Contents?: true

Size: 719 Bytes

Versions: 3

Compression:

Stored size: 719 Bytes

Contents

module FeatherCms
  class Config
    class << self

      def init(&block)
        @@config ||= {}

        yield self if block_given? 

        @@config[:layouts] = Dir.entries(Rails.root.to_s + '/app/views/layouts').reject do |i|
          i.start_with?('.', '_') || File.directory?(i)
        end.collect{|l| l.split('.').first}
      end

      def layouts
        @@config[:layouts]
      end

      [:authentication, :sign_out_url, :template_types].each do |attr|
        class_eval <<-METHOD, __FILE__, __LINE__ + 1
          def #{attr}=(value)
            @@config[:#{attr}] = value
          end

          def #{attr}
            @@config[:#{attr}]
          end
        METHOD
      end

    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
feather_cms-0.0.5.2 lib/feather_cms/config.rb
feather_cms-0.0.5.1 lib/feather_cms/config.rb
feather_cms-0.0.5 lib/feather_cms/config.rb