What you need

1. Ruby

Obtain and install Ruby. Download Ruby.

2. The Ruby Lemma

Download the Lemma gem and examples.

3. Build the Lemma

In a terminal within the ruby lemma directory:

Build the lemma gem.

gem build noam_lemma.gemspec

Install the gem

gem install noam_lemma-version.gem

4. Review the example scripts

Located in /examples/ folder.

Using the Ruby Lemma


Any ruby guest must include

require 'noam_lemma'

Initialize a Lemma

guestName is the ID Noam Hosts will associate with your application. If roomName is left blank, the lemma is a Free Guest and may be grabbed by any Host via the Host Interface. Otherwise, it will only join a host with the specified roomName.

lemma = Noam::Lemma.new(


Note: registering for spoken Topics is optional - topics can be added dynamically in-application by simply speaking them to the Host.

Hear Messages

Inside your do loop, hear messages.

loop do
  message = lemma.listen //hear messages and return event object

Access parameters of the event object

# Return the Topic Name

# Return the Message Value


This example creates a guest named Ruby Guest set to join Test Room. Registers to listen for messages on topic exampleTopic and prints received messages.

require 'noam_lemma'

lemma = Noam::Lemma.new(
  'Ruby Guest',

lemma.advertise("Test Room")

loop do
  # The `listen` method will return an Event object once one is received by the
  # Lemma. Until an event is heard, the `listen` method blocks.
  message = lemma.listen

  # prints the topic name and message value
  puts "Read: #{m.ident} -> #{m.value.inspect}" 

Speak Messages

Inside the do loop, speak messages.

lemma.play( <topicName>, <messageValue> )


This example creates a guest named Ruby Guest set to join Test Room. Registers to peridically send messages to topic exampleTopic.

require 'noam_lemma'

lemma = Noam::Lemma.new(
  'Ruby Guest',

publisher.advertise("Test Room")

seq = 0
loop do
  # Construct a value to send with the event.
  v = {"seq" => seq, "time" => Time.now.to_s}

  # If `play` returns false, we're unable to play the message likely because
  # the socket has closed. The connection would have to be restarted.
  unless publisher.play("exampleTopic", v)
    puts "Done"
  puts "Wrote: #{e} -> #{v.inspect}"

  seq += 1
  # Sleep for a while so that we don't bog down the network.


• Listening fails un-gracefully when the Noam host goes down.


If you're interested in checking out the source or contributing to this Lemma, visit our GitHub repository.