class Trestle::Scopes::Definition
Attributes
blocks[R]
options[R]
Public Class Methods
new()
click to toggle source
# File lib/trestle/scopes/definition.rb, line 6 def initialize @blocks = [] @options = {} end
Public Instance Methods
append(&block)
click to toggle source
# File lib/trestle/scopes/definition.rb, line 11 def append(&block) @blocks << Block.new(&block) end
evaluate(context)
click to toggle source
Evaluates each of the scope blocks within the given admin context and returns a hash of Scope
objects keyed by the scope name.
# File lib/trestle/scopes/definition.rb, line 17 def evaluate(context) @blocks.map { |block| block.scopes(context) }.flatten.index_by(&:name) end