class Signaly::Status

how many PMs, notifications, invitations a user has at a time

Public Class Methods

new(pm=0, notifications=0, invitations=0) click to toggle source
Calls superclass method
# File lib/signaly/status.rb, line 5
def initialize(pm=0, notifications=0, invitations=0)
  super(pm, notifications, invitations)
end

Public Instance Methods

>(other) click to toggle source

does self have anything new compared with other?

# File lib/signaly/status.rb, line 15
def >(other)
  if other.nil?
    return true
  end

  [:pm, :notifications, :invitations].each do |prop|
    if send(prop) > other.send(prop) then
      return true
    end
  end

  return false
end
changed?(old_status, prop) click to toggle source

is there any change between old_status and self in property prop?

# File lib/signaly/status.rb, line 30
def changed?(old_status, prop)
  (old_status == nil && self[prop] > 0) ||
    (old_status != nil && self[prop] != old_status[prop])
end
is_there_anything?() click to toggle source
# File lib/signaly/status.rb, line 9
def is_there_anything?
  self.each_pair {|k,v| return true if v > 0 }
  return false
end