Sha256: 6c805786a1f279c1e0b85ff3a3195217a8174d9d66c2d30a160d65dd746dfa27

Contents?: true

Size: 407 Bytes

Versions: 1

Compression:

Stored size: 407 Bytes

Contents

# frozen_string_literal: true

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

class Contact
  include Voltage

  attr_reader :name, :email

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

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
voltage-0.1.0 examples/block_context.rb