chione 0.6.0 → 0.7.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 74a32ca8c0efb477b978216b6371d24c2cf2fabd037dade6424fdf3cda693bc8
4
- data.tar.gz: cdc91fa64ece44754a3e4f687836195113779f96f64a7a01dffb64a6dcf3ed75
3
+ metadata.gz: 68568324cd3702ff7d9fcb81ab3ff0c28872b64aae1159a408a7ca712828e5cd
4
+ data.tar.gz: 9a935e5afdc2a19fd050b1fd7dac4fd6a0c4c3c9c6bfced6d227dcac73bb267a
5
5
  SHA512:
6
- metadata.gz: 1a21d24764d7ca1745ac3dbc5741a0782a569c1beb68cb643de4d6fff5f01ea03f12db588206c5941ed51d7c762210f1b0dba4d45a81b26d44fc7b47144cbe35
7
- data.tar.gz: d15d0593e77f38c31fd437d6580e576466ddd45c50646b80502b7196b21ddfad7ca68f3c7a1a3dfdf8ff073d9f5fcacef8cc5711b7978e34de27877ea22116d0
6
+ metadata.gz: cb0b3390ee788d9071941d7b2925875ddc6151e4804b6682cb397703452d6e4f119889f3564adb9c51c5e7d869341c26a38177212ab23768cf2ebd92d1d784fc
7
+ data.tar.gz: f056e79be5aa6d75367272f2c8935c7d9842cf4c8c607b5353d2016937f1efd1dcf3a8652529dde7730e6a694eac34044cbc7427b260f1ba1bbb9b4a220e1743
checksums.yaml.gz.sig CHANGED
Binary file
data/History.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## v0.7.0 [2018-07-11] Michael Granger <ged@FaerieMUD.org>
2
+
3
+ Enhancements:
4
+
5
+ - Add a convenience method for creating Aspects that will match Archetypes
6
+
7
+
1
8
  ## v0.6.0 [2018-07-05] Michael Granger <ged@FaerieMUD.org>
2
9
 
3
10
  Enhancements:
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
@@ -12,7 +12,7 @@ module Chione
12
12
  extend Loggability
13
13
 
14
14
  # Gem version
15
- VERSION = '0.6.0'
15
+ VERSION = '0.7.0'
16
16
 
17
17
 
18
18
  # Loggability API -- set up a log host
@@ -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.6.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-06 00:00:00.000000000 Z
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.9'
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.9'
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.16'
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.16'
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