class Nibbler::MessageBuilder

Constants

CHANNEL_MESSAGE
SYSTEM_MESSAGE

Attributes

name[R]
num_nibbles[R]

Public Class Methods

build_system_exclusive(library, *message_data) click to toggle source
# File lib/nibbler/message_builder.rb, line 58
def self.build_system_exclusive(library, *message_data)
  library.system_exclusive(*message_data)
end
for_channel_message(library, status) click to toggle source
# File lib/nibbler/message_builder.rb, line 67
def self.for_channel_message(library, status)
  type = CHANNEL_MESSAGE.find { |type| type[:status] == status }
  new(library, type[:name], type[:nibbles])
end
for_system_message(library, status) click to toggle source
# File lib/nibbler/message_builder.rb, line 62
def self.for_system_message(library, status)
  type = SYSTEM_MESSAGE.find { |type| type[:status].cover?(status) }
  new(library, type[:name], type[:nibbles])
end
new(library, name, num_nibbles) click to toggle source
# File lib/nibbler/message_builder.rb, line 72
def initialize(library, name, num_nibbles)
  @library = library
  @name = name
  @num_nibbles = num_nibbles
end

Public Instance Methods

build(*message_data) click to toggle source
# File lib/nibbler/message_builder.rb, line 78
def build(*message_data)
  @library.send(@name, *message_data)
end