ceml 0.5.1 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.1
1
+ 0.5.2
data/ceml.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ceml}
8
- s.version = "0.5.1"
8
+ s.version = "0.5.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Joe Edelman"]
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
- iid = x.id
19
- INCIDENTS[iid] = x
20
- PLAYERS[iid] = []
21
- iid
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
- case meth
27
- when :said
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
@@ -14,7 +14,7 @@ module CEML
14
14
  this.delete :recognized
15
15
  end
16
16
 
17
- def initialize(script, id = rand(36**10).to_s(36))
17
+ def initialize(script, id)
18
18
  @id = id
19
19
  @script = Script === script ? script : CEML.parse(:script, script)
20
20
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 5
8
- - 1
9
- version: 0.5.1
8
+ - 2
9
+ version: 0.5.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Joe Edelman