Sha256: b1372f0537ba8d5b949164439b4038e4637c7a646dc496bc67744e21eb49745d

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

require "noam_lemma"

class Noam::LemmaVerification
  def self.run
    echo
    plus_one
    sum
    name
  end

  def self.echo
    lemma = Noam::Lemma.new("verification", ["Echo"], ["EchoVerify"])
    lemma.advertise("lemma_verification")
    event = lemma.listen
    lemma.speak("EchoVerify", event.value)
    lemma.stop
  end

  def self.plus_one
    lemma = Noam::Lemma.new("verification", ["PlusOne"], ["PlusOneVerify"])
    lemma.advertise("lemma_verification")
    event = lemma.listen
    lemma.speak("PlusOneVerify", event.value + 1)
    lemma.stop
  end

  def self.sum
    lemma = Noam::Lemma.new("verification", ["Sum"], ["SumVerify"])
    lemma.advertise("lemma_verification")
    event = lemma.listen
    lemma.speak("SumVerify", event.value.inject {|sum, v| sum + v})
    lemma.stop
  end

  def self.name
    lemma = Noam::Lemma.new("verification", ["Name"], ["NameVerify"])
    lemma.advertise("lemma_verification")
    event = lemma.listen
    fullname = "#{event.value["firstName"]} #{event.value["lastName"]}"
    lemma.speak("NameVerify", {fullName: fullname})
    lemma.stop
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
noam_lemma-0.2.1.1 examples/lemma_verification.rb
noam_lemma-0.2.1 examples/lemma_verification.rb