Sha256: 29fe08eac1af35da9f7549ca9d326cefca5e4b96c4bfdfc78b991bd3e696925e

Contents?: true

Size: 467 Bytes

Versions: 4

Compression:

Stored size: 467 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 |*, team| team.save end
end

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

# Output is:
# saving...
# saving...
# saving...

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
after_do-0.4.0 samples/within_class.rb
after_do-0.3.1 samples/within_class.rb
after_do-0.3.0 samples/within_class.rb
after_do-0.2.3 samples/within_class.rb