caixanegra 0.3.2 → 0.3.4

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: fb4779b627ddc5ebd55e9c850f03e68f40bbf756dde4e4763fb17f0cf950ab23
4
- data.tar.gz: f89c2792fdfb858459f59fcf1e5107ddae08f63b4855f2f6e9e76b00e1d56ab4
3
+ metadata.gz: 37e8a2fbf540c8bfe1f1c85cf1dd82638bde895abe10bf24369860a6996c1c7b
4
+ data.tar.gz: f65ae1c5c97c7cd8264c157d93748748ec7e8084e7baba2c3f3c7113adfd60d9
5
5
  SHA512:
6
- metadata.gz: 70df0a2a5ece0c784212ecc917c8afab3eb511c96f5cb113f829a287871df4b7a4256d4a9c3d9155faa2d1e5a0a11b36bfe9d99e5048d960e0569d24977aff44
7
- data.tar.gz: a7664006cf88ed6d68ee39d5186649e0f7a2f28a55ed0405e0db129a4e86bd8b3e8b8b6e1cfed81b750a1f569fe5d799f98957cc917a2981b2b311085339a326
6
+ metadata.gz: 7eb792dd9e30f18921dd6ff8c4bab52a9c564f4f93204aeb8925bf5e0255093e64e00dfb9b16b9ac0f19991fccf9868157e17c788cafa66932ef5112f96b187d
7
+ data.tar.gz: '09b9f690181fd28e25f5a8cd25ee1e3588af0c9efdadcd3597676fb80d9b93cbec43563d73a4086314f73fab34b11c27653cab163f10521121dd04c85a53a756'
data/README.md CHANGED
@@ -32,11 +32,14 @@ Caixanegra.setup do |config|
32
32
  config.units = [
33
33
  Caixanegra::Units::AwesomeUnit,
34
34
  Some::Other::Namespace::AnotherAwesomeUnit,
35
- Caixanegra::Units::SuperUnit,
35
+ [Caixanegra::Units::NamespaceOne::SuperUnit, :ns1_super_unit],
36
+ [Caixanegra::Units::NamespaceTwo::SuperUnit, :ns2_super_unit],
36
37
  ]
37
38
  config.transient_store = GreatTransientStore.new
38
39
  end
39
40
  ```
41
+ While configuring units from your codebase, if provided in the array form, **caixanegra** will use the second array item as the class name. Otherwise it will infer from class.
42
+ **NOTE:** You can't have two classes with the same name as **caixanegra** will use the last one
40
43
 
41
44
  With the designer configured, you can use `Caixanegra::Manager` to handle the previously stored definition (or an empty one).
42
45
  This will give you the UID that **caixanegra** designer will understand, using transient store.
@@ -652,7 +652,10 @@ window.Caixanegra.Designer = {
652
652
  createUnit(params) {
653
653
  this.#sequence++;
654
654
  const newUnit = new Caixanegra.Designer.Unit({
655
- position: new Sabertooth.Vector2(20, 20),
655
+ position: new Sabertooth.Vector2(
656
+ -this.gre.worldCenter.x + 20,
657
+ -this.gre.worldCenter.y + 20
658
+ ),
656
659
  type: params.type,
657
660
  title: params.title,
658
661
  class: params.class,
@@ -7,7 +7,7 @@ module Caixanegra
7
7
  transient_store = Caixanegra.transient_store
8
8
  uid = transient_store.new_uid
9
9
 
10
- transient_store.hold(uid, flow_definition)
10
+ transient_store.hold(uid, definition: flow_definition)
11
11
 
12
12
  uid
13
13
  end
@@ -6,8 +6,13 @@ module Caixanegra
6
6
 
7
7
  scopes = (scope || "").split(",").map(&:to_sym)
8
8
  Caixanegra.units.each do |unit|
9
- if unit.scope.nil? || unit.scope.any? { |checking_scope| scopes.include?(checking_scope) }
10
- units[unit.name.demodulize.underscore.to_sym] = unit
9
+ unit_scope = unit.is_a?(Array) ? unit[0].scope : unit.scope
10
+ if unit_scope.nil? || unit_scope.any? { |checking_scope| scopes.include?(checking_scope) }
11
+ if unit.is_a? Array
12
+ units[unit[1]] = unit[0]
13
+ else
14
+ units[unit.name.demodulize.underscore.to_sym] = unit
15
+ end
11
16
  end
12
17
  end
13
18
 
@@ -18,11 +23,15 @@ module Caixanegra
18
23
  units = {}
19
24
 
20
25
  Caixanegra.units.each do |unit|
21
- units[unit.name.demodulize.underscore.to_sym] = unit
26
+ if unit.is_a? Array
27
+ units[unit[1]] = unit[0]
28
+ else
29
+ units[unit.name.demodulize.underscore.to_sym] = unit
30
+ end
22
31
  end
23
32
 
24
33
  units
25
34
  end
26
35
  end
27
36
  end
28
- end
37
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Caixanegra
4
- VERSION = '0.3.2'
4
+ VERSION = '0.3.4'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caixanegra
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - sergiorribeiro
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-04 00:00:00.000000000 Z
11
+ date: 2023-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails