Class: ServiceObjects::Message

Inherits:
Object
  • Object
show all
Defined in:
lib/service_objects/message.rb

Overview

Describes messages to be returned by service objects

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.textString (readonly)

The text of the message

Returns:

  • (String)


27
28
29
# File 'lib/service_objects/message.rb', line 27

def text
  @text
end

.typeSymbol (readonly)

The type of the message

Returns:

  • (Symbol)


32
33
34
# File 'lib/service_objects/message.rb', line 32

def type
  @type
end

Class Method Details

.initialize(type, text) ⇒ Object



18
19
20
21
22
# File 'lib/service_objects/message.rb', line 18

def initialize(type, text)
  @type = type.to_sym
  @text = text.to_s.freeze
  freeze
end

.new(type, text) ⇒ ServiceObjects::Message

Creates the immutable message with type and text

Parameters:

  • type (#to_sym)
  • text (#to_s)

Returns:



# File 'lib/service_objects/message.rb', line 8