Sha256: 20e8387b5e502a9e4922b07d99a94b34afb84e0bbed1a40613700b12ab400454
Contents?: true
Size: 812 Bytes
Versions: 3
Compression:
Stored size: 812 Bytes
Contents
class Card module Set class Event module Callbacks def set_event_callbacks %i[before after around].each do |kind| next unless (object_method = @opts.delete kind) set_event_callback object_method, kind end end def set_event_callback object_method, kind valid_event_callback kind, object_method do Card.class_exec(self) do |event| set_callback object_method, kind, event.name, prepend: true, if: proc { |c| c.event_applies?(event) } end end end def valid_event_callback kind, method yield rescue NoMethodError raise "invalid event callback: `#{kind}: #{method}`" end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
card-1.96.8 | lib/card/set/event/callbacks.rb |
card-1.96.7 | lib/card/set/event/callbacks.rb |
card-1.96.6 | lib/card/set/event/callbacks.rb |