Class: Brut::TUI::Script::Events::Message

Inherits:
Events::BaseEvent show all
Defined in:
lib/brut/tui/script/events/message.rb

Overview

Fired when a step produces a message

Instance Method Summary collapse

Methods inherited from Events::BaseEvent

#drain_then_exit?, #exit?, handler_method_name

Constructor Details

#initialize(message:, type:) ⇒ Message

Returns a new instance of Message.



3
4
5
6
# File 'lib/brut/tui/script/events/message.rb', line 3

def initialize(message:, type:)
  @message = message
  @type    = type
end

Instance Method Details

#deconstruct_keys(keys = nil) ⇒ Object

Includes message and type. type will be :notify, :warning, :success, :error, or :done, however it could be anything else the script may choose to use.



12
13
14
# File 'lib/brut/tui/script/events/message.rb', line 12

def deconstruct_keys(keys=nil)
  super.merge({ message: @message, type: @type })
end

#to_sObject



8
# File 'lib/brut/tui/script/events/message.rb', line 8

def to_s = @message