Sha256: 057efdbf8315dbe7f9b0b4254b1c70ee0fa9e1c07b999d7c16de2eee8b56af1e

Contents?: true

Size: 737 Bytes

Versions: 19

Compression:

Stored size: 737 Bytes

Contents

module Cell::Prefixes
  def self.included(includer)
    includer.extend(ClassMethods)
  end

  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

19 entries across 19 versions & 1 rubygems

Version Path
cells-4.1.8 lib/cell/prefixes.rb
cells-4.1.7 lib/cell/prefixes.rb
cells-4.1.6 lib/cell/prefixes.rb
cells-4.1.5 lib/cell/prefixes.rb
cells-4.1.4 lib/cell/prefixes.rb
cells-4.1.3 lib/cell/prefixes.rb
cells-4.1.2 lib/cell/prefixes.rb
cells-4.1.1 lib/cell/prefixes.rb
cells-4.1.0 lib/cell/prefixes.rb
cells-4.1.0.rc1 lib/cell/prefixes.rb
cells-4.0.5 lib/cell/prefixes.rb
cells-4.0.4 lib/cell/prefixes.rb
cells-4.0.3 lib/cell/prefixes.rb
cells-4.0.2 lib/cell/prefixes.rb
cells-4.0.1 lib/cell/prefixes.rb
cells-4.0.0 lib/cell/prefixes.rb
cells-4.0.0.rc1 lib/cell/prefixes.rb
cells-4.0.0.beta6 lib/cell/prefixes.rb
cells-4.0.0.beta5 lib/cell/prefixes.rb