Module: Clamour::Message::ClassMethods

Defined in:
lib/clamour/message.rb

Instance Method Summary collapse

Instance Method Details

#of_type(new_value = nil) ⇒ Object

Voluntarily set message type.

Examples:

class Parcel < Clamour::Message
  of_type 'snail.mail'
end

Parameters:

  • new_value (String) (defaults to: nil)


23
24
25
# File 'lib/clamour/message.rb', line 23

def of_type(new_value = nil)
  @type = new_value.to_s
end

#typeString

Message type. By default it is snake cased class name.

Returns:

  • (String)


30
31
32
# File 'lib/clamour/message.rb', line 30

def type
  @type ||= ActiveSupport::Inflector.underscore(to_s).gsub('/', '.')
end