Sha256: fcbcec66294e3572b5f759bcd61e68c6d8783ba3098c2ee0118d962738848198

Contents?: true

Size: 384 Bytes

Versions: 1

Compression:

Stored size: 384 Bytes

Contents

$:.unshift File.expand_path("../../lib", __FILE__)
require "signal"

class Contact
  include Signal

  attr_reader :name, :email

  def initialize(name, email)
    @name, @email = name, email
  end

  def output!
    emit(:output, self)
  end
end

contact = Contact.new("John Doe", "john@example.org")
contact.on(:output) {|contact| puts contact.name, contact.email }
contact.output!

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
signal-1.1.0 examples/block_context.rb