Sha256: 29f5c180d708e100e6140c94829dd870ec46a7f3ff4db342ba60422964938a57

Contents?: true

Size: 384 Bytes

Versions: 5

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

5 entries across 5 versions & 1 rubygems

Version Path
signal-1.0.0 examples/block_context.rb
signal-0.3.0 examples/block_context.rb
signal-0.2.2 examples/block_context.rb
signal-0.2.1 examples/block_context.rb
signal-0.2.0 examples/block_context.rb