Class: Baleen::Message::ToClient

Inherits:
Base
  • Object
show all
Defined in:
lib/baleen/message/to_client.rb

Instance Method Summary collapse

Methods inherited from Base

#results

Methods included from Serializable

deserialize, #dup, #method_missing, #params, symbolize_keys, #to_json

Constructor Details

#initialize(opt) ⇒ ToClient

Returns a new instance of ToClient.



7
8
9
10
11
# File 'lib/baleen/message/to_client.rb', line 7

def initialize(opt)
  super()
  @params[:message] = opt[:message]
  @params[:level]   = opt[:level]
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Baleen::Serializable

Instance Method Details



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/baleen/message/to_client.rb', line 17

def print_message
  case level
    when "info"
      hl_info message
    when "warn"
      hl_warn message
    when "error"
      hl_error message
    else
      hl_error "Unknown message level"
      hl_error inspect
  end
end

#terminate?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/baleen/message/to_client.rb', line 13

def terminate?
  false
end