Sha256: a9c10f1e21cf13f807e4371d0bdcfc53bf1232c47ba474ef306567b555106a28
Contents?: true
Size: 786 Bytes
Versions: 1
Compression:
Stored size: 786 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 self end def stop_masquerade @active_account, @masquerading = nil, nil self 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cantango-masquerade-0.1.3.2 | lib/cantango/masquerade/api/masquerade/account.rb |