Sha256: 1d41cbfa29526954c83ad2591e61821c5f351ca0042690e6e7194cd54b505e33

Contents?: true

Size: 410 Bytes

Versions: 5

Compression:

Stored size: 410 Bytes

Contents

module Trestle
  class Scopes
    extend ActiveSupport::Autoload

    autoload :Block
    autoload :Scope

    attr_reader :admin, :blocks

    def initialize(admin)
      @admin = admin
      @blocks = []
    end

    def append(&block)
      @blocks << Block.new(admin, &block)
    end

    def evaluate(context)
      @blocks.map { |block| block.scopes(context) }.flatten.index_by(&:name)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
trestle-0.9.2 lib/trestle/scopes.rb
trestle-0.9.1 lib/trestle/scopes.rb
trestle-0.9.0 lib/trestle/scopes.rb
trestle-0.8.13 lib/trestle/scopes.rb
trestle-0.8.12 lib/trestle/scopes.rb