Sha256: 7535573eee9051b691e24fd7f61bd1389e91e0b56a52d35d08e7ceb7a5a2afaf

Contents?: true

Size: 1.25 KB

Versions: 3

Compression:

Stored size: 1.25 KB

Contents

module HighVoltage
  module Configuration
    CACHING_DEPRECATION_WARNING = <<-WARNING.strip_heredoc.squish
    Caching support has been deprecated and will be removed
    in the next release.
    WARNING

    attr_accessor(
      :content_path,
      :home_page,
      :layout,
      :parent_engine,
      :route_drawer,
      :routes,
    )

    attr_reader :action_caching, :action_caching_layout, :page_caching

    def configure
      yield self
    end

    def self.extended(base)
      base.set_default_configuration
    end

    def action_caching=(value)
      ActiveSupport::Deprecation.warn(CACHING_DEPRECATION_WARNING)
      @action_caching = value
    end

    def action_caching_layout=(value)
      ActiveSupport::Deprecation.warn(CACHING_DEPRECATION_WARNING)
      @action_caching_layout = value
    end

    def page_caching=(value)
      ActiveSupport::Deprecation.warn(CACHING_DEPRECATION_WARNING)
      @page_caching = value
    end

    def set_default_configuration
      @action_caching = false
      @action_caching_layout = true
      @page_caching = false

      self.content_path = 'pages/'
      self.home_page = nil
      self.layout = 'application'
      self.route_drawer = HighVoltage::RouteDrawers::Default
      self.routes = true
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
high_voltage-2.3.0 lib/high_voltage/configuration.rb
high_voltage-2.2.1 lib/high_voltage/configuration.rb
high_voltage-2.2.0 lib/high_voltage/configuration.rb