chione 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/History.md +7 -0
- data/lib/chione/aspect.rb +9 -0
- data/lib/chione/world.rb +3 -2
- data/lib/chione.rb +1 -1
- data/spec/chione/aspect_spec.rb +28 -0
- data.tar.gz.sig +0 -0
- metadata +6 -6
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68568324cd3702ff7d9fcb81ab3ff0c28872b64aae1159a408a7ca712828e5cd
|
4
|
+
data.tar.gz: 9a935e5afdc2a19fd050b1fd7dac4fd6a0c4c3c9c6bfced6d227dcac73bb267a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb0b3390ee788d9071941d7b2925875ddc6151e4804b6682cb397703452d6e4f119889f3564adb9c51c5e7d869341c26a38177212ab23768cf2ebd92d1d784fc
|
7
|
+
data.tar.gz: f056e79be5aa6d75367272f2c8935c7d9842cf4c8c607b5353d2016937f1efd1dcf3a8652529dde7730e6a694eac34044cbc7427b260f1ba1bbb9b4a220e1743
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/History.md
CHANGED
data/lib/chione/aspect.rb
CHANGED
@@ -40,6 +40,15 @@ class Chione::Aspect
|
|
40
40
|
end
|
41
41
|
|
42
42
|
|
43
|
+
### Create a new Aspect that will match the given +archetype+, unless the given
|
44
|
+
### archetype was created from an existing Aspect, in which case just returns
|
45
|
+
### that.
|
46
|
+
def self::for_archetype( archetype )
|
47
|
+
return archetype.from_aspect if archetype.from_aspect
|
48
|
+
return self.new.with_all_of( archetype.components.keys )
|
49
|
+
end
|
50
|
+
|
51
|
+
|
43
52
|
### Create a new empty Aspect
|
44
53
|
def initialize( one_of: [], all_of: [], none_of: [] )
|
45
54
|
@one_of = Set.new( one_of )
|
data/lib/chione/world.rb
CHANGED
@@ -103,11 +103,11 @@ class Chione::World
|
|
103
103
|
# Whether or not to queue published events instead of sending them to
|
104
104
|
# subscribers immediately.
|
105
105
|
attr_predicate_accessor :defer_events
|
106
|
+
alias_method :deferring_events?, :defer_events?
|
106
107
|
|
107
108
|
##
|
108
109
|
# The queue of events that have not yet been sent to subscribers.
|
109
110
|
attr_reader :deferred_events
|
110
|
-
alias_method :deferring_events?, :defer_events?
|
111
111
|
|
112
112
|
|
113
113
|
### Start the world; returns the Thread in which the world is running.
|
@@ -259,7 +259,8 @@ class Chione::World
|
|
259
259
|
|
260
260
|
### Send any deferred events to subscribers.
|
261
261
|
def publish_deferred_events
|
262
|
-
self.log.debug "Publishing %d deferred events" % [ self.deferred_events.length ]
|
262
|
+
self.log.debug "Publishing %d deferred events" % [ self.deferred_events.length ] unless
|
263
|
+
self.deferred_events.empty?
|
263
264
|
while event = self.deferred_events.shift
|
264
265
|
self.call_subscription_callbacks( *event )
|
265
266
|
end
|
data/lib/chione.rb
CHANGED
data/spec/chione/aspect_spec.rb
CHANGED
@@ -229,5 +229,33 @@ describe Chione::Aspect do
|
|
229
229
|
end
|
230
230
|
|
231
231
|
|
232
|
+
describe "and Archetypes" do
|
233
|
+
|
234
|
+
let( :testing_archetype ) do
|
235
|
+
arch = Module.new do
|
236
|
+
def self::name; "Testing"; end
|
237
|
+
end
|
238
|
+
arch.extend( Chione::Archetype )
|
239
|
+
arch.add( location )
|
240
|
+
arch.add( color )
|
241
|
+
arch
|
242
|
+
end
|
243
|
+
|
244
|
+
|
245
|
+
it "can be created to match a particular Archetype" do
|
246
|
+
instance = described_class.for_archetype( testing_archetype )
|
247
|
+
expect( instance ).to be_a( described_class )
|
248
|
+
expect( instance.all_of ).to contain_exactly( location, color )
|
249
|
+
end
|
250
|
+
|
251
|
+
|
252
|
+
it "reuses an instance used to create an archetype" do
|
253
|
+
instance = described_class.with_all_of([ color ]).with_one_of([ tags, location ])
|
254
|
+
arch = Chione::Archetype.from_aspect( instance )
|
255
|
+
expect( described_class.for_archetype(arch) ).to equal( instance )
|
256
|
+
end
|
257
|
+
|
258
|
+
end
|
259
|
+
|
232
260
|
end
|
233
261
|
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chione
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Granger
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
X0qdrKi+2aZZ0NGuFj9AItBsVmAvkBGIpX4TEKQp5haEbPpmaqO5nIIhV26PXmyT
|
36
36
|
OMKv6pWsoS81vw5KAGBmfX8nht/Py90DQrbRvakATGI=
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2018-07-
|
38
|
+
date: 2018-07-11 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: loggability
|
@@ -155,14 +155,14 @@ dependencies:
|
|
155
155
|
requirements:
|
156
156
|
- - "~>"
|
157
157
|
- !ruby/object:Gem::Version
|
158
|
-
version: '0.
|
158
|
+
version: '0.10'
|
159
159
|
type: :development
|
160
160
|
prerelease: false
|
161
161
|
version_requirements: !ruby/object:Gem::Requirement
|
162
162
|
requirements:
|
163
163
|
- - "~>"
|
164
164
|
- !ruby/object:Gem::Version
|
165
|
-
version: '0.
|
165
|
+
version: '0.10'
|
166
166
|
- !ruby/object:Gem::Dependency
|
167
167
|
name: hoe-highline
|
168
168
|
requirement: !ruby/object:Gem::Requirement
|
@@ -225,14 +225,14 @@ dependencies:
|
|
225
225
|
requirements:
|
226
226
|
- - "~>"
|
227
227
|
- !ruby/object:Gem::Version
|
228
|
-
version: '3.
|
228
|
+
version: '3.17'
|
229
229
|
type: :development
|
230
230
|
prerelease: false
|
231
231
|
version_requirements: !ruby/object:Gem::Requirement
|
232
232
|
requirements:
|
233
233
|
- - "~>"
|
234
234
|
- !ruby/object:Gem::Version
|
235
|
-
version: '3.
|
235
|
+
version: '3.17'
|
236
236
|
description: |-
|
237
237
|
An Entity/Component System framework inspired by Artemis.
|
238
238
|
|
metadata.gz.sig
CHANGED
Binary file
|