Sha256: 929e3ae3b22537994e0b6ddb84608354de6ac4ee4a2adb6219bb5ce98eb5af29
Contents?: true
Size: 1.08 KB
Versions: 2
Compression:
Stored size: 1.08 KB
Contents
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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
notification-settings-1.0.0.beta10 | lib/notification_settings/setting_library.rb |
notification-settings-1.0.0.beta9 | lib/notification_settings/setting_library.rb |