y_petri 2.0.14.p1 → 2.0.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/y_petri/place/guard.rb +7 -9
- data/lib/y_petri/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 04fefe57afd5fa9850489c3d5dcfe27ffd520e05
|
4
|
+
data.tar.gz: f544785cc23baa8b9d26d0afb15984d8c85c59a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 705160694568b66998cbeff7a273113e5a84f80d97f14fe161c427bf95d06894e4eee6d0cc8a7b9e4f60aec4c1483b8685826df339de92c3a7856eda4a3c8f3b
|
7
|
+
data.tar.gz: 98e978bf1c89bcef1bac79c5b1f3a90dbfc48fc98842cd18569f46a672a2484853fc0a7d1d1f1e70c883db6a13c849e85e888b98ac1d7702733d34c4dbe95969
|
data/lib/y_petri/place/guard.rb
CHANGED
@@ -6,9 +6,7 @@ class YPetri::Place
|
|
6
6
|
# Marking guard.
|
7
7
|
#
|
8
8
|
class Guard
|
9
|
-
ERRMSG = -> m,
|
10
|
-
"Marking #{m}:#{m.class}#{pl ? " of place #{pl}" : ''} #{assert}!"
|
11
|
-
end
|
9
|
+
ERRMSG = -> m, assert { "Marking #{m}:#{m.class} #{assert}!" }
|
12
10
|
|
13
11
|
attr_reader :assertion, :block
|
14
12
|
|
@@ -34,9 +32,9 @@ class YPetri::Place
|
|
34
32
|
# Validates a supplied marking value against the guard block. Raises
|
35
33
|
# +YPetri::GuardError+ if the guard fails, otherwise returns _true_.
|
36
34
|
#
|
37
|
-
def validate(
|
38
|
-
λ = __fail__(
|
39
|
-
λ.call if @Lab.new( λ ).instance_exec(
|
35
|
+
def validate( marking_value )
|
36
|
+
λ = __fail__( marking_value, assertion )
|
37
|
+
λ.call if @Lab.new( λ ).instance_exec( marking_value, &block ) == false
|
40
38
|
return true
|
41
39
|
end
|
42
40
|
|
@@ -44,8 +42,8 @@ class YPetri::Place
|
|
44
42
|
|
45
43
|
# Constructs the fail closure.
|
46
44
|
#
|
47
|
-
def __fail__
|
48
|
-
-> { fail YPetri::GuardError, ERRMSG.(
|
45
|
+
def __fail__ marking_value, assertion
|
46
|
+
-> { fail YPetri::GuardError, ERRMSG.( marking_value, assertion ) }
|
49
47
|
end
|
50
48
|
end
|
51
49
|
|
@@ -94,7 +92,7 @@ class YPetri::Place
|
|
94
92
|
#
|
95
93
|
def federated_guard_closure
|
96
94
|
lineup = guards.dup
|
97
|
-
-> m { lineup.each { |g| g.validate
|
95
|
+
-> m { lineup.each { |g| g.validate m }; return m }
|
98
96
|
end
|
99
97
|
|
100
98
|
# Applies guards on the marking currently owned by the place.
|
data/lib/y_petri/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: y_petri
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.14
|
4
|
+
version: 2.0.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- boris
|
@@ -125,9 +125,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
125
125
|
version: '0'
|
126
126
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
127
|
requirements:
|
128
|
-
- - '
|
128
|
+
- - '>='
|
129
129
|
- !ruby/object:Gem::Version
|
130
|
-
version:
|
130
|
+
version: '0'
|
131
131
|
requirements: []
|
132
132
|
rubyforge_project:
|
133
133
|
rubygems_version: 2.0.3
|