Sha256: 954f5dd5f9593a5b7a62d34206210859920236e3784673d333c8206d6acecadd

Contents?: true

Size: 506 Bytes

Versions: 4

Compression:

Stored size: 506 Bytes

Contents

require 'attr_pow'
require 'pp'

class Foobar
  attr_pow :shopper, hooks: true
  attr_pow :shop_queue, queue: true

  def customers &block
    shopper_add &block
  end

  def purchase stype
    shopper_hooks(stype)
  end
end

fb = Foobar.new
fb.customers do |stype|
  puts "Bob: #{stype} bought"
  "bob_#{stype}"
end

fb.customers do |stype|
  puts "James: #{stype} bought"
  "james_#{stype}"
end

bag1 = fb.purchase :shirt
bag2 = fb.purchase :pants

pp bag1
pp bag2

fb.shop_queue << bag1 << bag2
puts ""

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
attr_pow-0.0.5 examples/shops.rb
attr_pow-0.0.4 examples/shops.rb
attr_pow-0.0.3 examples/shops.rb
attr_pow-0.0.2 examples/shops.rb