Sha256: 7167facb6191ffccbbc9570c982075c00650419f1329c731efbdb23d1689be84
Contents?: true
Size: 1.11 KB
Versions: 11
Compression:
Stored size: 1.11 KB
Contents
require 'active_support' module NotificationSettings module SettingLibrary extend ActiveSupport::Concern included do include NotificationSettings::SettingLibrary::InstanceMethods end module InstanceMethods def status if self.object.respond_to?(NotificationSettings.configuration.last_seen) && ( Time.now - self.object.send(NotificationSettings.configuration.last_seen) ).round >= NotificationSettings.configuration.idle_after && ( Time.now - self.object.send(NotificationSettings.configuration.last_seen) ).round < NotificationSettings.configuration.offline_after default = 'idle' elsif self.object.respond_to?(NotificationSettings.configuration.last_seen) && ( Time.now - self.object.send(NotificationSettings.configuration.last_seen) ).round >= NotificationSettings.configuration.offline_after default = 'offline' else 'online' end self[:status] || default end end end end
Version data entries
11 entries across 11 versions & 1 rubygems