ceml 0.5.7 → 0.5.8
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/ceml.gemspec +1 -1
- data/lib/ceml/driver.rb +5 -8
- data/test/helper.rb +1 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.8
|
data/ceml.gemspec
CHANGED
data/lib/ceml/driver.rb
CHANGED
@@ -11,31 +11,28 @@ module CEML
|
|
11
11
|
|
12
12
|
PLAYERS = {}
|
13
13
|
INCIDENTS = {}
|
14
|
-
def with_incident(id, script = nil)
|
14
|
+
def with_incident(id, script = nil, metadata = {})
|
15
15
|
id ||= rand(36**10).to_s(36)
|
16
16
|
PLAYERS[id] ||= []
|
17
17
|
INCIDENTS[id] ||= CEML::Incident.new script, id if script
|
18
18
|
raise "no incident #{id}" unless INCIDENTS[id]
|
19
|
-
yield INCIDENTS[id], PLAYERS[id],
|
19
|
+
yield INCIDENTS[id], PLAYERS[id], metadata if block_given?
|
20
20
|
id
|
21
21
|
end
|
22
|
+
alias_method :start, :with_incident
|
22
23
|
|
23
24
|
LOCATIONS = {}
|
24
|
-
def ping script, candidate
|
25
|
+
def ping script, candidate, metadata = {}
|
25
26
|
LOCATIONS[script] ||= []
|
26
27
|
script.post candidate, LOCATIONS[script]
|
27
28
|
LOCATIONS[script].delete_if do |loc|
|
28
29
|
next unless loc.cast
|
29
|
-
with_incident nil, script do |incident, players, metadata|
|
30
|
+
with_incident nil, script, metadata do |incident, players, metadata|
|
30
31
|
loc.cast.each{ |guy| subpost incident, players, metadata, guy.initial_state }
|
31
32
|
end
|
32
33
|
end
|
33
34
|
end
|
34
35
|
|
35
|
-
def start(script, id = nil)
|
36
|
-
with_incident(id, script)
|
37
|
-
end
|
38
|
-
|
39
36
|
def post incident_id, player = nil
|
40
37
|
with_incident incident_id do |incident, players, metadata|
|
41
38
|
subpost incident, players, metadata, player
|
data/test/helper.rb
CHANGED