durable_rules 2.0.4 → 2.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/librb/durable.rb +1 -3
  3. data/librb/engine.rb +8 -9
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0adaaf5bd93fde23db48196c84cc4c19a6e54eab
4
- data.tar.gz: f4a48336da9a8b928da8baf5b0288796b89820e4
3
+ metadata.gz: 4f2783f44507366a2029205429dd94b99da4fdb8
4
+ data.tar.gz: 15e4d147d321f18e701583d1cb0f1a77dac4a977
5
5
  SHA512:
6
- metadata.gz: e23ee1d4cbf5e2b42e5054bb862c56b502473759e3d468b66c12e08b41a8dba35a96845c30c2a57d003a9f7cd0ed61653ac830dcf579a9013bb48c65b2e361d7
7
- data.tar.gz: aaf8e986ee09e907c794145f2d9cd2052cf75a1e1c4493c38e750a3d32eefbb9e701cf3234b7bc4280d736c9c2b8b2dfeb537f8b45a8069483ccb2397878ae7a
6
+ metadata.gz: 73533cb05af0e9d0a5190187f5636e49fcbe000e7c2f374d3d142d20a998a94f22016a4570f1623e4809c8698d2d1a403afc1ca5aa2879a991998f2b93fa36d5
7
+ data.tar.gz: 9ba5938a86bb9737246f6779a9d499f06eb116b2d079d5b2ac521769cbfde26b220c4dd68af14e12d1e5238927d155518e714aed5764d3b7a0e65dc8a06726a2
data/librb/durable.rb CHANGED
@@ -9,9 +9,7 @@ module Durable
9
9
  @@main_host = Engine::Host.new
10
10
  end
11
11
 
12
- for name, ruleset in @@rulesets
13
- @@main_host.set_ruleset name, ruleset
14
- end
12
+ @@main_host.register_rulesets @@rulesets
15
13
 
16
14
  @@rulesets = {}
17
15
  @@main_host
data/librb/engine.rb CHANGED
@@ -403,20 +403,17 @@ module Engine
403
403
  Rules.renew_action_lease @handle, sid.to_s
404
404
  end
405
405
 
406
- def Ruleset.create_rulesets(parent_name, host, ruleset_definitions)
406
+ def Ruleset.create_rulesets(host, ruleset_definitions)
407
407
  branches = {}
408
408
  for name, definition in ruleset_definitions do
409
409
  name = name.to_s
410
410
  if name.end_with? "$state"
411
411
  name = name[0..-7]
412
- name = "#{parent_name}.#{name}" if parent_name
413
412
  branches[name] = Statechart.new name, host, definition
414
413
  elsif name.end_with? "$flow"
415
414
  name = name[0..-6]
416
- name = "#{parent_name}.#{name}" if parent_name
417
415
  branches[name] = Flowchart.new name, host, definition
418
416
  else
419
- name = "#{parent_name}.#{name}" if parent_name
420
417
  branches[name] = Ruleset.new name, host, definition
421
418
  end
422
419
  end
@@ -929,9 +926,11 @@ module Engine
929
926
  @ruleset_directory[ruleset_name]
930
927
  end
931
928
 
932
- def set_ruleset(ruleset_name, ruleset_definition)
933
- register_rulesets nil, { ruleset_name => ruleset_definition }
934
- save_ruleset ruleset_name, ruleset_definition
929
+ def set_rulesets(ruleset_definitions)
930
+ register_rulesets ruleset_definitions
931
+ for ruleset_name, ruleset_definition in ruleset_definitions do
932
+ save_ruleset ruleset_name, ruleset_definition
933
+ end
935
934
  end
936
935
 
937
936
  def post(ruleset_name, event, complete = nil)
@@ -993,8 +992,8 @@ module Engine
993
992
  get_ruleset(ruleset_name).renew_action_lease sid
994
993
  end
995
994
 
996
- def register_rulesets(parent_name, ruleset_definitions)
997
- rulesets = Ruleset.create_rulesets(parent_name, self, ruleset_definitions)
995
+ def register_rulesets(ruleset_definitions)
996
+ rulesets = Ruleset.create_rulesets(self, ruleset_definitions)
998
997
  for ruleset_name, ruleset in rulesets do
999
998
  if @ruleset_directory.key? ruleset_name
1000
999
  raise ArgumentError, "Ruleset with name #{ruleset_name} already registered"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: durable_rules
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.4
4
+ version: 2.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jesus Ruiz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-17 00:00:00.000000000 Z
11
+ date: 2019-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake