Class: Zuul::ActionController::Evaluators::ForTarget

Inherits:
Object
  • Object
show all
Defined in:
lib/zuul/action_controller/evaluators.rb

Direct Known Subclasses

ForPermission, ForRole, ForRoleOrHigher

Instance Method Summary collapse

Instance Method Details

#else(&block) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/zuul/action_controller/evaluators.rb', line 15

def else(&block)
  return self if @dsl.nil?
  if !match?
    @controller.instance_eval do
      yield
    end if block_given?
  end
  self
end

#else_for(target, context = nil, force_context = nil, &block) ⇒ Object



25
26
27
# File 'lib/zuul/action_controller/evaluators.rb', line 25

def else_for(target, context=nil, force_context=nil, &block)
  return self.class.new(@controller, target, context, force_context, &block)
end

#for_target(&block) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/zuul/action_controller/evaluators.rb', line 5

def for_target(&block)
  return self if @dsl.nil?
  if match?
    @controller.instance_eval do
      yield
    end if block_given?
  end
  self
end