Module: Mchat::ModApi

Included in:
Repl
Defined in:
lib/mchat/repl.rb

Instance Method Summary collapse

Instance Method Details

#_chat_screen_print(content) ⇒ Object Also known as: _puts2



37
38
39
40
41
# File 'lib/mchat/repl.rb', line 37

def _chat_screen_print(content)
  # TODO add log
  # @printer.display(content)
  @store.message_writer(content)
end

#_cli_screen_print(content) ⇒ Object Also known as: _puts



43
44
45
46
# File 'lib/mchat/repl.rb', line 43

def _cli_screen_print(content)
  # TODO add log
  puts content
end

#_current_channelObject



21
22
23
# File 'lib/mchat/repl.rb', line 21

def _current_channel
  @current_channel
end

#_current_nicknameObject



29
30
31
# File 'lib/mchat/repl.rb', line 29

def _current_nickname
  @current_nickname
end

#_dispatch(name, content = nil) ⇒ Object



48
49
50
51
52
53
54
# File 'lib/mchat/repl.rb', line 48

def _dispatch(name, content = nil)
  if content
    __send__(name, content)
  else
    __send__(name)
  end
end

#_mchat_action(content) ⇒ Object



67
68
69
70
71
72
73
# File 'lib/mchat/repl.rb', line 67

def _mchat_action(content)
  _puts2 Message.new({
                      "user_name" => "Mchat [action]",
                      "timestamp" => Time.now.to_i,
                      "content" => content
                    }).display
end

#_mchat_speak(content) ⇒ Object



59
60
61
62
63
64
65
# File 'lib/mchat/repl.rb', line 59

def _mchat_speak(content)
  _puts2 Message.new({
                      "user_name" => "Mchat",
                      "timestamp" => Time.now.to_i,
                      "content" => content
                    }).display
end

#_set_current_channel(channel_name) ⇒ Object



25
26
27
# File 'lib/mchat/repl.rb', line 25

def _set_current_channel(channel_name)
  @current_channel = channel_name
end

#_set_current_nickname(nickname) ⇒ Object



33
34
35
# File 'lib/mchat/repl.rb', line 33

def _set_current_nickname(nickname)
  @current_nickname = nickname
end