module Consul::Controller::InstanceMethods
Private Instance Methods
current_power()
click to toggle source
# File lib/consul/controller.rb, line 95 def current_power @current_power_class && @current_power_class.current end
ensure_power_initializer_present()
click to toggle source
# File lib/consul/controller.rb, line 110 def ensure_power_initializer_present unless self.class.current_power_initializer.present? raise Consul::UnreachablePower, 'You included Consul::Controller but forgot to define a power using current_power do ... end' end end
unchecked_power()
click to toggle source
# File lib/consul/controller.rb, line 91 def unchecked_power raise Consul::UncheckedPower, "This controller does not check against a power" end
with_current_power(&action)
click to toggle source
# File lib/consul/controller.rb, line 99 def with_current_power(&action) power = instance_eval(&self.class.current_power_initializer) or raise Consul::Error, 'current_power initializer returned nil' @current_power_class = power.class @current_power_class.current = power action.call ensure if @current_power_class @current_power_class.current = nil end end