Sha256: 641c32d71d386050870668584c3eaec4d276683b955ed4ace00175b129e81cf1

Contents?: true

Size: 535 Bytes

Versions: 3

Compression:

Stored size: 535 Bytes

Contents

module Trestle
  class Scopes
    class Definition
      attr_reader :blocks, :options

      def initialize
        @blocks = []
        @options = {}
      end

      def append(options={}, &block)
        @blocks << Block.new(options, &block)
      end

      # Evaluates each of the scope blocks within the given admin context
      # and returns a hash of Scope objects keyed by the scope name.
      def evaluate(context)
        @blocks.map { |block| block.scopes(context) }.flatten.index_by(&:name)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
trestle-0.10.0 lib/trestle/scopes/definition.rb
trestle-0.10.0.pre2 lib/trestle/scopes/definition.rb
trestle-0.10.0.pre lib/trestle/scopes/definition.rb