class IntercomRails::Proxy::User
Constants
- PREDEFINED_POTENTIAL_USER_OBJECTS
Public Class Methods
current_in_context(search_object)
click to toggle source
# File lib/intercom-rails/proxy/user.rb, line 29 def self.current_in_context(search_object) potential_user_objects.each do |potential_object| begin user_proxy = new(search_object.instance_eval(&potential_object), search_object) return user_proxy if user_proxy.valid? raise ExcludedUserFoundError if user_proxy.excluded? rescue NameError next end end raise NoUserFoundError end
potential_user_objects()
click to toggle source
# File lib/intercom-rails/proxy/user.rb, line 17 def self.potential_user_objects if config.current.present? if config.current.kind_of?(Array) config.current.map { |user| Proc.new { instance_eval &user } } else [Proc.new { instance_eval &IntercomRails.config.user.current }] end else PREDEFINED_POTENTIAL_USER_OBJECTS end end
Public Instance Methods
excluded?()
click to toggle source
# File lib/intercom-rails/proxy/user.rb, line 54 def excluded? config.user.exclude_if.present? && config.user.exclude_if.call(user) end
standard_data()
click to toggle source
Calls superclass method
IntercomRails::Proxy::Proxy#standard_data
# File lib/intercom-rails/proxy/user.rb, line 42 def standard_data super.tap do |hsh| hsh[:user_id] = hsh.delete(:id) if hsh.has_key?(:id) end end
valid?()
click to toggle source
# File lib/intercom-rails/proxy/user.rb, line 48 def valid? return false if user.blank? || user.respond_to?(:new_record?) && user.new_record? return false if excluded? identity_present? end