Sha256: 492c6fca4bbd6c5804a56c4308299be902f65091a81e0a7b1d203291df325344

Contents?: true

Size: 739 Bytes

Versions: 1

Compression:

Stored size: 739 Bytes

Contents

# TODO: cache _prefixes on class layer.
module Cell::Prefixes
  extend ActiveSupport::Concern

  def _prefixes
    self.class.prefixes
  end

  # You're free to override those methods in case you want to alter our view inheritance.
  module ClassMethods
    def prefixes
      @prefixes ||= _prefixes
    end

  private
    def _prefixes
      return [] if abstract?
      _local_prefixes + superclass.prefixes
    end

    def _local_prefixes
      view_paths.collect { |path| "#{path}/#{controller_path}" }
    end

    # Instructs Cells to inherit views from a parent cell without having to inherit class code.
    def inherit_views(parent)
      define_method :_prefixes do
        super() + parent.prefixes
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cells-4.0.0.beta4 lib/cell/prefixes.rb