Sha256: a27c9680d495e3b89c23c16f95c87e8957d165f0102b114bd3c3e4308f6f2a90
Contents?: true
Size: 775 Bytes
Versions: 9
Compression:
Stored size: 775 Bytes
Contents
class TestTrack::IdentitySessionDiscriminator attr_reader :identity def initialize(identity) @identity = identity end def controller @controller ||= RequestStore[:test_track_controller] end def authenticated_resource_matches_identity? controller_has_authenticated_resource? && controller.send(authenticated_resource_method_name) == identity end def web_context? controller.present? end private def controller_has_authenticated_resource? # pass true to `respond_to?` to include private methods web_context? && controller.respond_to?(authenticated_resource_method_name, true) end def authenticated_resource_method_name @authenticated_resource_method_name ||= "current_#{identity.class.model_name.element}" end end
Version data entries
9 entries across 9 versions & 1 rubygems