Sha256: 4a0bbbe996475262f061bec36f605fcf9f115638cf38d5c1c9ae402b07e6a593

Contents?: true

Size: 762 Bytes

Versions: 6

Compression:

Stored size: 762 Bytes

Contents

module MadChatter
  class Action
    
    def self.inherited(extension_class)
      MadChatter.extension_classes << extension_class.new
    end    
    
    # Helper methods
    
    def stop_message_handling
      raise 'Dont call anymore message listeners'
    end
    
    def send_json(json)
      MadChatter::Server.send_json(json)
    end
    
    def send_message(text)
      message = MadChatter::Message.new('message', text)
      send_json(message.to_s)
    end
    
    def send_status_message(text)
      message = MadChatter::Message.new('status', text)
      send_json(message.to_s)
    end
    
    def send_users_list
      message = MadChatter::Message.new('users', MadChatter::Users.current)
      send_json(message.to_s)
    end
    
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mad_chatter-0.2.1 lib/mad_chatter/action.rb
mad_chatter-0.2.0 lib/mad_chatter/action.rb
mad_chatter-0.1.3 lib/mad_chatter/action.rb
mad_chatter-0.1.2 lib/mad_chatter/action.rb
mad_chatter-0.1.1 lib/mad_chatter/action.rb
mad_chatter-0.1.0 lib/mad_chatter/action.rb