contextr 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/History.txt +6 -0
- data/LICENSE.txt +2 -1
- data/README.txt +1 -0
- data/lib/contextr/class_methods.rb +4 -6
- data/lib/contextr/inner_class.rb +1 -1
- data/lib/contextr/layer.rb +17 -23
- data/lib/contextr/version.rb +1 -1
- metadata +3 -3
- metadata.gz.sig +5 -1
data.tar.gz.sig
CHANGED
Binary file
|
data/History.txt
CHANGED
data/LICENSE.txt
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
ContextR is copyrighted free software by Gregor Schmidt <ruby@schmidtwisser.de
|
1
|
+
ContextR is copyrighted free software by Gregor Schmidt <ruby@schmidtwisser.de>,
|
2
|
+
Software-Architecture-Group, Hasso-Plattner-Institute, Potsdam, Germany.
|
2
3
|
You can redistribute it and/or modify it under either the terms of the GPL
|
3
4
|
(see COPYING file), or the conditions below:
|
4
5
|
|
data/README.txt
CHANGED
@@ -66,14 +66,12 @@ module ContextR # :nodoc:
|
|
66
66
|
|
67
67
|
def on_core_method_called(receiver, contextified_class,
|
68
68
|
method_name, arguments, block)
|
69
|
-
proxies = []
|
70
|
-
active_layers_as_classes.each do |layer|
|
71
|
-
proxies += layer.context_proxies(receiver,
|
72
|
-
contextified_class,
|
73
|
-
method_name)
|
74
|
-
end.compact
|
75
69
|
|
70
|
+
proxies = active_layers_as_classes.inject([]) do |array, layer|
|
71
|
+
array << layer.context_proxy(contextified_class, method_name)
|
72
|
+
end.compact
|
76
73
|
proxies << core_proxy(receiver, contextified_class, method_name)
|
74
|
+
|
77
75
|
call_methods_stack(proxies.reverse, receiver,
|
78
76
|
method_name, arguments, block)
|
79
77
|
end
|
data/lib/contextr/inner_class.rb
CHANGED
@@ -13,7 +13,7 @@ module ContextR
|
|
13
13
|
# hide +instance_eval+ or any method beginning with "__".
|
14
14
|
def hide(name)
|
15
15
|
if instance_methods.include?(name.to_s) and
|
16
|
-
name !~ /^(__
|
16
|
+
name !~ /^(__)/
|
17
17
|
@hidden_methods ||= {}
|
18
18
|
@hidden_methods[name.to_sym] = instance_method(name)
|
19
19
|
undef_method name
|
data/lib/contextr/layer.rb
CHANGED
@@ -20,9 +20,7 @@ module ContextR # :nodoc:
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def add_method_collection(contextified_class, methods_module)
|
23
|
-
definitions[contextified_class]
|
24
|
-
definitions[contextified_class].delete(methods_module)
|
25
|
-
definitions[contextified_class].push(methods_module)
|
23
|
+
definitions[contextified_class] = methods_module
|
26
24
|
|
27
25
|
(methods_module.instance_methods &
|
28
26
|
contextified_class.instance_methods).each do | method_name |
|
@@ -31,34 +29,30 @@ module ContextR # :nodoc:
|
|
31
29
|
register_callbacks(contextified_class, methods_module)
|
32
30
|
end
|
33
31
|
|
34
|
-
def
|
35
|
-
if definitions.include?(contextified_class)
|
36
|
-
|
37
|
-
|
38
|
-
end
|
39
|
-
else
|
40
|
-
[]
|
32
|
+
def methods_module_containing_method(contextified_class, method_name)
|
33
|
+
if definitions.include?(contextified_class) and
|
34
|
+
definitions[contextified_class].instance_methods.include?(method_name.to_s)
|
35
|
+
definitions[contextified_class]
|
41
36
|
end
|
42
37
|
end
|
43
38
|
|
44
|
-
def
|
45
|
-
|
46
|
-
|
47
|
-
context_proxy_for_module(receiver, methods_module)
|
48
|
-
end.reverse
|
49
|
-
end
|
39
|
+
def context_proxy(contextified_class, method_name)
|
40
|
+
methods_module = methods_module_containing_method(contextified_class,
|
41
|
+
method_name)
|
50
42
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
43
|
+
if methods_module
|
44
|
+
proxies[methods_module] ||= begin
|
45
|
+
p = ContextR::InnerClass.new
|
46
|
+
class << p; self; end.class_eval do
|
47
|
+
include(methods_module)
|
48
|
+
end
|
49
|
+
p
|
50
|
+
end
|
56
51
|
end
|
57
52
|
end
|
58
53
|
|
59
54
|
def on_class_method_added(contextified_class, method_name, version)
|
60
|
-
|
61
|
-
method_name).empty?
|
55
|
+
if methods_module_containing_method(contextified_class, method_name)
|
62
56
|
replace_core_method(contextified_class, method_name, version)
|
63
57
|
end
|
64
58
|
end
|
data/lib/contextr/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: contextr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregor Schmidt
|
@@ -30,7 +30,7 @@ cert_chain:
|
|
30
30
|
y3O9DT3o4BiyPe77
|
31
31
|
-----END CERTIFICATE-----
|
32
32
|
|
33
|
-
date: 2008-
|
33
|
+
date: 2008-04-24 00:00:00 +02:00
|
34
34
|
default_executable:
|
35
35
|
dependencies: []
|
36
36
|
|
@@ -112,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
112
|
requirements: []
|
113
113
|
|
114
114
|
rubyforge_project: contextr
|
115
|
-
rubygems_version: 1.
|
115
|
+
rubygems_version: 1.1.1
|
116
116
|
signing_key:
|
117
117
|
specification_version: 2
|
118
118
|
summary: The goal is to equip Ruby with an API to allow context-oriented programming.
|
metadata.gz.sig
CHANGED
@@ -1 +1,5 @@
|
|
1
|
-
�
|
1
|
+
�5>FV�a�oD��X����t
|
2
|
+
�)�[�s�&�8s#5L��m��u���?`
|
3
|
+
5�q�Vښ��3MEZ't7+ד�f���������3ƟL�j�;2A0�TO���p��cξ-��'�;3٣�Q��"��eF�V���z��TE�}��ŀ�%�ځ�!�Eq�G�K�O�w�g�+����&��ż�-���4v��>D�8
|
4
|
+
c��
|
5
|
+
�M�__N�?�U���^9�%3
|