Sha256: 29ba52d2ae619cc5cac8a6b5d9042d0accfc95883a08b961112668727017a2f2
Contents?: true
Size: 756 Bytes
Versions: 5
Compression:
Stored size: 756 Bytes
Contents
module CanTango module Api module Masquerade module Account attr_reader :masquerading, :active_account def masquerade_as account raise "Must be a registered type of account, was: #{account}" unless valid_account? account @masquerading = true @active_account = account end def stop_masquerade @active_account, @masquerading = nil, nil end def masquerading? !@masquerading.nil? end private def valid_account? account registered_accounts.registered_class?(account.class) end def registered_accounts CanTango.config.accounts end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems