[sup-devel] [issue14] Poll update message should accumulate changes if UI is idle

Mark Anderson markr.anderson at amd.com
Wed Nov 18 15:27:03 EST 2009


So I tried cattr_accessor, and that doesn't work without Rails, apparently, so I just did this:

class PollTotals
  def PollTotals.all
    @@all
  end
  def PollTotals.all=(value)
    @@all=value
  end

  def PollTotals.inbox
    @@inbox
  end
  def PollTotals.inbox=(value)
    @@inbox=value
  end

  @@all=0
  @@inbox=0
end

PollTotals.all   += num
PollTotals.inbox += num_inbox

info "Total #{PollTotals.all} messages, #{PollTotals.inbox} to inbox"
# or however the logger thingy worked...

However, that gives the following. 

Loaded 1 new message, 0 to inbox.
/home/manderso/.sup/hooks/after-poll.rb:2: warning: redefine all
/home/manderso/.sup/hooks/after-poll.rb:5: warning: redefine all=
/home/manderso/.sup/hooks/after-poll.rb:9: warning: redefine inbox
/home/manderso/.sup/hooks/after-poll.rb:12: warning: redefine inbox=

It seems a bit wasteful to redefine the class every time through, is there a better hook to put this in?



More information about the Sup-devel mailing list