drsi 0.0.2 → 0.0.3
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 +4 -4
- data/lib/drsi/dci/context.rb +8 -8
- data/lib/drsi/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11309067339e57a0aa6717ea6034208661896539
|
4
|
+
data.tar.gz: 139fd79736dea05182ac7ec019a5d4d7a98648cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4aae9e60790998f6f1e194d3dd1b0aff8d1c85012bad35e4ef118d982d40254983be9868754714b7f465c2292a8e878c46a4243b79977b1245e9a131f9dcee7
|
7
|
+
data.tar.gz: c21408e5e63dc26e2ea4cb9d687208ae6b33e9506f5c55ef3c02fcb7f47cb26181a6fbb43d2f6ee5b92ae62e9bec0bd67d2d1be9f9aa3af17f73e1caaa9babda
|
data/lib/drsi/dci/context.rb
CHANGED
@@ -13,7 +13,7 @@ module DCI
|
|
13
13
|
def self.roles; @roles end
|
14
14
|
def roles; self.class.roles end
|
15
15
|
private :roles
|
16
|
-
|
16
|
+
assign_unplay_roles_within_instance_methods!
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
@@ -77,14 +77,14 @@ module DCI
|
|
77
77
|
# player objects before the execution and to un-assign roles from player objects at the end of execution just
|
78
78
|
# before returning control.
|
79
79
|
# Also inject code to magically do the same to every new method defined in klass.
|
80
|
-
def
|
81
|
-
|
82
|
-
|
80
|
+
def assign_unplay_roles_within_instance_methods!
|
81
|
+
instance_methods(false).each do |existing_methodname|
|
82
|
+
assign_unplay_roles_within_instance_method!(existing_methodname)
|
83
83
|
end
|
84
|
-
def
|
84
|
+
def self.method_added(methodname)
|
85
85
|
if not @context_internals and public_method_defined?(methodname)
|
86
86
|
@context_internals = true
|
87
|
-
|
87
|
+
assign_unplay_roles_within_instance_method!(methodname)
|
88
88
|
@context_internals = false
|
89
89
|
end
|
90
90
|
end
|
@@ -92,8 +92,8 @@ module DCI
|
|
92
92
|
|
93
93
|
# Wraps the given klass's methodname to assign/un-assign roles to player objects before and after actual method
|
94
94
|
# execution.
|
95
|
-
def
|
96
|
-
|
95
|
+
def assign_unplay_roles_within_instance_method!(methodname)
|
96
|
+
class_eval do
|
97
97
|
method_object = instance_method(methodname)
|
98
98
|
define_method(methodname) do |*args, &block|
|
99
99
|
players_play_role!
|
data/lib/drsi/version.rb
CHANGED