Sha256: 018da031542a27288d236c636ddd76591fed67f6020648e514fd5326ebdba2a5

Contents?: true

Size: 576 Bytes

Versions: 4

Compression:

Stored size: 576 Bytes

Contents

# TODO: merge into Rails core.
# TODO: cache _prefixes on class layer.
module Cell::Prefixes
  extend ActiveSupport::Concern

  def _prefixes
    self.class._prefixes
  end

  module ClassMethods
    def _prefixes
      return [] if abstract?
      _local_prefixes + superclass._prefixes
    end

    def _local_prefixes
      [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

4 entries across 4 versions & 2 rubygems

Version Path
cells-4.0.0.beta3 lib/cell/prefixes.rb
cells-4.0.0.beta2 lib/cell/prefixes.rb
cells-4.0.0.beta1 lib/cell/prefixes.rb
cells-jamie-4.0.0.alpha1 lib/cell/prefixes.rb