Sha256: 820d52ddf8cfa780de376bf3de45efe8130aa654223964727f5e77550675946c

Contents?: true

Size: 388 Bytes

Versions: 3

Compression:

Stored size: 388 Bytes

Contents

# frozen_string_literal: true

$LOAD_PATH.unshift File.expand_path("../lib", __dir__)
require "signal"

class Contact
  include Signal.call

  attr_reader :name, :email

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

  def call
    emit(:output, self)
  end
end

Contact.call("John", "john@example.com") do |o|
  o.on(:output) {|contact| puts contact.name }
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
signal-1.3.1 examples/call.rb
signal-1.3.0 examples/call.rb
signal-1.2.0 examples/call.rb