Module: Card::Set::Event::SkipAndTrigger

Included in:
All
Defined in:
lib/card/set/event/skip_and_trigger.rb

Overview

opt into (trigger) or out of (skip) events

Instance Method Summary collapse

Instance Method Details

#skip=(skip_val) ⇒ Object



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

def skip= skip_val
  @skip_hash = @full_skip_hash = nil
  @skip = skip_val
end

#skip_event!(*events) ⇒ Object

force skipping this event for all cards in act



38
39
40
41
# File 'lib/card/set/event/skip_and_trigger.rb', line 38

def skip_event! *events
  @full_skip_hash = nil
  force_events events, act_skip_hash
end

#skip_event?(event) ⇒ Boolean

Returns:

  • (Boolean)


68
69
70
# File 'lib/card/set/event/skip_and_trigger.rb', line 68

def skip_event? event
  full_skip_hash.key? event.to_s
end

#skip_event_in_action!(*events) ⇒ Object

force skipping this event for this card only



44
45
46
# File 'lib/card/set/event/skip_and_trigger.rb', line 44

def skip_event_in_action! *events
  force_events events, full_skip_hash
end

#skip_hashObject

hash form of raw skip setting, eg { “my_event” => true }



60
61
62
# File 'lib/card/set/event/skip_and_trigger.rb', line 60

def skip_hash
  @skip_hash ||= hash_with_value skip, true
end

#skip_in_action=(skip_val) ⇒ Object



22
23
24
25
# File 'lib/card/set/event/skip_and_trigger.rb', line 22

def skip_in_action= skip_val
  @skip_hash = @full_skip_hash = nil
  @skip_in_action = skip_val
end

#trigger=(trigger_val) ⇒ Object



27
28
29
30
# File 'lib/card/set/event/skip_and_trigger.rb', line 27

def trigger= trigger_val
  @trigger_hash = @full_trigger_hash = nil
  @trigger = trigger_val
end

#trigger_event!(*events) ⇒ Object

force triggering this event (when it comes up) for all cards in act



49
50
51
52
# File 'lib/card/set/event/skip_and_trigger.rb', line 49

def trigger_event! *events
  @full_trigger_hash = nil
  force_events events, act_trigger_hash
end

#trigger_event?(event) ⇒ Boolean

Returns:

  • (Boolean)


72
73
74
# File 'lib/card/set/event/skip_and_trigger.rb', line 72

def trigger_event? event
  full_trigger_hash.key? event.to_s
end

#trigger_event_in_action!(*events) ⇒ Object

force triggering this event (when it comes up) for this card only



55
56
57
# File 'lib/card/set/event/skip_and_trigger.rb', line 55

def trigger_event_in_action! *events
  force_events events, full_trigger_hash
end

#trigger_hashObject



64
65
66
# File 'lib/card/set/event/skip_and_trigger.rb', line 64

def trigger_hash
  @trigger_hash ||= hash_with_value trigger, true
end

#trigger_in_action=(trigger_val) ⇒ Object



32
33
34
35
# File 'lib/card/set/event/skip_and_trigger.rb', line 32

def trigger_in_action= trigger_val
  @trigger_hash = @full_trigger_hash = nil
  @trigger_in_action = trigger_val
end