ceml 0.5.1 → 0.5.2
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 +12 -11
- data/lib/ceml/incident.rb +1 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.2
|
data/ceml.gemspec
CHANGED
data/lib/ceml/driver.rb
CHANGED
@@ -13,21 +13,22 @@ module CEML
|
|
13
13
|
INCIDENTS = {}
|
14
14
|
JUST_SAID = {}
|
15
15
|
|
16
|
-
def start(script)
|
17
|
-
x = CEML::Incident.new script
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
16
|
+
def start(script, id = rand(36**10).to_s(36))
|
17
|
+
x = CEML::Incident.new script, id
|
18
|
+
INCIDENTS[id] = x
|
19
|
+
PLAYERS[id] = []
|
20
|
+
id
|
21
|
+
end
|
22
|
+
|
23
|
+
def player_said(incident_id, player, what)
|
24
|
+
JUST_SAID[player[:id]] = what
|
25
|
+
puts "Said #{what.inspect}"
|
22
26
|
end
|
23
27
|
|
24
28
|
def run(incident_id)
|
25
29
|
INCIDENTS[incident_id].run(PLAYERS[incident_id]) do |player, meth, what|
|
26
|
-
|
27
|
-
|
28
|
-
JUST_SAID[player[:id]] = what
|
29
|
-
puts "Said #{what.inspect}"
|
30
|
-
end
|
30
|
+
meth = "player_#{meth}"
|
31
|
+
send(meth, incident_id, player, what) if respond_to? meth
|
31
32
|
end
|
32
33
|
end
|
33
34
|
|
data/lib/ceml/incident.rb
CHANGED