Sha256: 55544897e77987edfad803252bca5071b7c45167bb85a1a272f386006d7add4b

Contents?: true

Size: 514 Bytes

Versions: 4

Compression:

Stored size: 514 Bytes

Contents

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

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

      def append(&block)
        @blocks << Block.new(&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

4 entries across 4 versions & 1 rubygems

Version Path
trestle-0.9.8 lib/trestle/scopes/definition.rb
trestle-0.9.7 lib/trestle/scopes/definition.rb
trestle-0.9.6 lib/trestle/scopes/definition.rb
trestle-0.9.5 lib/trestle/scopes/definition.rb