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 CHANGED
Binary file
@@ -1,3 +1,9 @@
1
+ == 1.0.1 2008-04-01
2
+
3
+ * minor changes
4
+ * internal refactorings
5
+ * updated copyrights
6
+
1
7
  == 1.0.0 2008-04-01
2
8
 
3
9
  * this is the first stable release
@@ -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
@@ -13,3 +13,4 @@ This code is published under the same license as Ruby. See LICENSE.txt for more
13
13
  information.
14
14
 
15
15
  (c) 2007 - Gregor Schmidt - Berlin, Germany
16
+ Software-Architecture-Group, Hasso-Plattner-Institute, Potsdam, Germany
@@ -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
@@ -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 !~ /^(__|extend)/
16
+ name !~ /^(__)/
17
17
  @hidden_methods ||= {}
18
18
  @hidden_methods[name.to_sym] = instance_method(name)
19
19
  undef_method name
@@ -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 methods_modules_containing_method(contextified_class, method_name)
35
- if definitions.include?(contextified_class)
36
- definitions[contextified_class].select do | methods_module |
37
- methods_module.instance_methods.include?(method_name.to_s)
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 context_proxies(receiver, contextified_class, method_name)
45
- methods_modules_containing_method(contextified_class, method_name).
46
- collect do | methods_module |
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
- def context_proxy_for_module(receiver, methods_module)
52
- proxies[methods_module] ||= begin
53
- p = ContextR::InnerClass.new.extend(methods_module)
54
- class << p; hide(:extend); end
55
- p
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
- unless methods_modules_containing_method(contextified_class,
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
@@ -2,7 +2,7 @@ module ContextR #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 1
4
4
  MINOR = 0
5
- TINY = 0
5
+ TINY = 1
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
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.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-03-29 23:00:00 +01:00
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.0.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
- T��,���&(�!�.���ɯ��/��糝M\\O���`��<\��=�I��n��+�ge��8�:�Q=^��sD�r���ԀtqD^�E���.�,߭�l)GS�sjȇD�&� 6��הh��CHu(gc�� ���s�ߒ��?����Q�A�= ��⓯\�r!�Ξ�;4��0����A�Ж�V�>r�m���u��B������蜒��S�vcE���O\����H���΂�w}
1
+ 5>FVaoD��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