module Consul::Controller::InstanceMethods
Private Instance Methods
Source
# File lib/consul/controller.rb, line 131 def current_power @current_power_class && @current_power_class.current end
Source
# File lib/consul/controller.rb, line 146 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
Source
# File lib/consul/controller.rb, line 127 def unchecked_power raise Consul::UncheckedPower, "This controller does not check against a power" end
Source
# File lib/consul/controller.rb, line 135 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