Sha256: b2e352e63853a8ce9003123b35bed92641b19627fd681383440f1264a982b70d

Contents?: true

Size: 299 Bytes

Versions: 5

Compression:

Stored size: 299 Bytes

Contents

module MadChatter
  class MessageHistory
    
    def initialize
       @stack = []
    end
    
    def add(message)
      @stack << message
      @stack = @stack.pop(10) if @stack.length > 10
    end
    
    def all
      @stack
    end
    
    def clear
      @stack = []
    end
    
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mad_chatter-0.3.4 lib/mad_chatter/message_history.rb
mad_chatter-0.3.3 lib/mad_chatter/message_history.rb
mad_chatter-0.3.2 lib/mad_chatter/message_history.rb
mad_chatter-0.3.1 lib/mad_chatter/message_history.rb
mad_chatter-0.3.0 lib/mad_chatter/message_history.rb