Sha256: c80f9398f5b7be58ba8c11ecc66e8160c2332d5800d5cf3f32320b57916f2b68

Contents?: true

Size: 422 Bytes

Versions: 3

Compression:

Stored size: 422 Bytes

Contents

require 'after_do'

class Team
  extend AfterDo
  
  def add_member(member)
    # ...
  end
  
  def remove_member(member)
    # ..
  end
  
  def change_name(new_name)
    # ..
  end
  
  def save
   # ..
   puts 'saving...'
  end
  
  after :add_member, :remove_member, :change_name do |*args, team| team.save end
end

team = Team.new
team.add_member 'Maren'
team.change_name 'Ruby Cherries'
team.remove_member 'Guilia'

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
after_do-0.2.2 samples/within_class.rb
after_do-0.2.1 samples/within_class.rb
after_do-0.2.0 samples/within_class.rb