ceml 0.5.7 → 0.5.8

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.7
1
+ 0.5.8
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.7"
8
+ s.version = "0.5.8"
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
@@ -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], {} if block_given?
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
@@ -9,7 +9,7 @@ class Test::Unit::TestCase
9
9
  DRIVER = CEML::Driver.new
10
10
 
11
11
  def play script = nil
12
- @iid = script && DRIVER.start(script)
12
+ @iid = script && DRIVER.start(nil, script)
13
13
  yield
14
14
  CEML::Driver::JUST_SAID.clear
15
15
  CEML::Driver::PLAYERS.clear
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 5
8
- - 7
9
- version: 0.5.7
8
+ - 8
9
+ version: 0.5.8
10
10
  platform: ruby
11
11
  authors:
12
12
  - Joe Edelman