Module: Card::Set::Event::All

Includes:
SkipAndTrigger
Included in:
CardMethods
Defined in:
card/lib/card/set/event/all.rb

Overview

card methods for scheduling events and testing event applicability

Instance Method Summary collapse

Methods included from SkipAndTrigger

#skip=, #skip_event!, #skip_event?, #skip_event_in_action!, #skip_hash, #skip_in_action=, #trigger=, #trigger_event!, #trigger_event?, #trigger_event_in_action!, #trigger_hash, #trigger_in_action=

Instance Method Details

#event_applies?(event) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
19
20
# File 'card/lib/card/set/event/all.rb', line 16

def event_applies? event
  return unless set_condition_applies? event.set_module, event.opts[:changing]

  CONDITIONS.all? { |c| send "#{c}_condition_applies?", event, event.opts[c] }
end

#schedule(event) ⇒ Object



6
7
8
9
10
11
12
# File 'card/lib/card/set/event/all.rb', line 6

def schedule event
  @scheduled ||= {}
  return if @scheduled[event.to_sym]

  send :"#{event}_with_delay"
  @scheduled[event.to_sym] = true
end