group_delegator 0.1.1
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.
- data/.document +5 -0
 - data/Gemfile +13 -0
 - data/LICENSE.txt +20 -0
 - data/README.rdoc +120 -0
 - data/Rakefile +50 -0
 - data/VERSION +1 -0
 - data/examples/compare_to_map.rb +50 -0
 - data/examples/diff_w_map.rb +21 -0
 - data/examples/find_troublemakers.rb +12 -0
 - data/examples/remote_component_update_sim.rb +47 -0
 - data/examples/search_examples_with_benchmarks.rb +40 -0
 - data/lib/group_delegator.rb +23 -0
 - data/lib/group_delegator/group_delegator_instances.rb +32 -0
 - data/lib/group_delegator/group_delegator_klasses.rb +62 -0
 - data/lib/group_delegator/source_group.rb +161 -0
 - data/lib/group_delegator/source_helper.rb +17 -0
 - data/spec/group_delegator_instances_spec.rb +150 -0
 - data/spec/group_delegator_klasses_spec.rb +270 -0
 - data/spec/group_delegator_spec.rb +12 -0
 - data/spec/source_group_spec.rb +259 -0
 - data/spec/spec_helper.rb +12 -0
 - metadata +152 -0
 
| 
         @@ -0,0 +1,12 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            describe "GroupDelegator Set Up" do
         
     | 
| 
      
 4 
     | 
    
         
            +
              it "loads all requires" do
         
     | 
| 
      
 5 
     | 
    
         
            +
                expect { SourceGroup }.to_not raise_error
         
     | 
| 
      
 6 
     | 
    
         
            +
                expect { SourceHelper }.to_not raise_error
         
     | 
| 
      
 7 
     | 
    
         
            +
                expect { GroupDelegatorInstances }.to_not raise_error
         
     | 
| 
      
 8 
     | 
    
         
            +
                expect { GroupDelegatorKlasses }.to_not raise_error
         
     | 
| 
      
 9 
     | 
    
         
            +
                expect { GroupDelegator }.to_not raise_error
         
     | 
| 
      
 10 
     | 
    
         
            +
              end
         
     | 
| 
      
 11 
     | 
    
         
            +
            end
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
         @@ -0,0 +1,259 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            #Source Classes for Testing
         
     | 
| 
      
 4 
     | 
    
         
            +
            class Base
         
     | 
| 
      
 5 
     | 
    
         
            +
              class<<self; attr_accessor :my_class_instance_var; end
         
     | 
| 
      
 6 
     | 
    
         
            +
              @@my_val = nil
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
              def self.set_class_method(set_val)
         
     | 
| 
      
 9 
     | 
    
         
            +
                @@my_val = set_val
         
     | 
| 
      
 10 
     | 
    
         
            +
              end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
              def self.get_class_method
         
     | 
| 
      
 13 
     | 
    
         
            +
                @@my_val
         
     | 
| 
      
 14 
     | 
    
         
            +
              end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
              attr_accessor :my_instance_var, :params, :my_val
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
              def initialize(params)
         
     | 
| 
      
 19 
     | 
    
         
            +
                @params = params
         
     | 
| 
      
 20 
     | 
    
         
            +
              end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
              def set_instance_method(set_val)
         
     | 
| 
      
 23 
     | 
    
         
            +
                @my_val = set_val
         
     | 
| 
      
 24 
     | 
    
         
            +
              end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
              def get_instance_method
         
     | 
| 
      
 27 
     | 
    
         
            +
                @my_val
         
     | 
| 
      
 28 
     | 
    
         
            +
              end
         
     | 
| 
      
 29 
     | 
    
         
            +
            end
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
            class A < Base
         
     | 
| 
      
 32 
     | 
    
         
            +
              def A.unique_result
         
     | 
| 
      
 33 
     | 
    
         
            +
                :A
         
     | 
| 
      
 34 
     | 
    
         
            +
              end
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
              def a_method_only
         
     | 
| 
      
 37 
     | 
    
         
            +
                :a
         
     | 
| 
      
 38 
     | 
    
         
            +
              end
         
     | 
| 
      
 39 
     | 
    
         
            +
            end
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
            class B < Base
         
     | 
| 
      
 42 
     | 
    
         
            +
              def B.unique_result
         
     | 
| 
      
 43 
     | 
    
         
            +
                :B
         
     | 
| 
      
 44 
     | 
    
         
            +
              end
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
              def b_method_only
         
     | 
| 
      
 47 
     | 
    
         
            +
                :b
         
     | 
| 
      
 48 
     | 
    
         
            +
              end
         
     | 
| 
      
 49 
     | 
    
         
            +
            end
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
            class C < Base
         
     | 
| 
      
 52 
     | 
    
         
            +
              def C.unique_result
         
     | 
| 
      
 53 
     | 
    
         
            +
                :C
         
     | 
| 
      
 54 
     | 
    
         
            +
              end
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
              def c_method_only
         
     | 
| 
      
 57 
     | 
    
         
            +
                :c
         
     | 
| 
      
 58 
     | 
    
         
            +
              end
         
     | 
| 
      
 59 
     | 
    
         
            +
            end
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
            #Testing SourceGroup
         
     | 
| 
      
 62 
     | 
    
         
            +
            shared_examples_for "a source group of class level objects" do
         
     | 
| 
      
 63 
     | 
    
         
            +
              describe "forwarding to source class level objects" do
         
     | 
| 
      
 64 
     | 
    
         
            +
                  it "can set and retrieve class instance variables using forward" do
         
     | 
| 
      
 65 
     | 
    
         
            +
                    expected_result = {A=>:class_iv_var, B=>:class_iv_var, C=>:class_iv_var}
         
     | 
| 
      
 66 
     | 
    
         
            +
                    source_class_group.forward(:my_class_instance_var=, :class_iv_var).should == expected_result
         
     | 
| 
      
 67 
     | 
    
         
            +
                    source_class_group.forward(:my_class_instance_var).should == expected_result
         
     | 
| 
      
 68 
     | 
    
         
            +
                  end
         
     | 
| 
      
 69 
     | 
    
         
            +
             
     | 
| 
      
 70 
     | 
    
         
            +
                  it "can send parameters to class methods" do
         
     | 
| 
      
 71 
     | 
    
         
            +
                    expected_result = {A=>"some val", B=>"some val", C=>"some val"}
         
     | 
| 
      
 72 
     | 
    
         
            +
                    source_class_group.forward(:set_class_method, "some val").should == expected_result
         
     | 
| 
      
 73 
     | 
    
         
            +
                    source_class_group.forward(:get_class_method).should == expected_result
         
     | 
| 
      
 74 
     | 
    
         
            +
                  end
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
      
 76 
     | 
    
         
            +
                  it "handles different return values " do
         
     | 
| 
      
 77 
     | 
    
         
            +
                    expected_result = {A=>:A, B=>:B, C=>:C}
         
     | 
| 
      
 78 
     | 
    
         
            +
                    source_class_group.forward(:unique_result).should == expected_result
         
     | 
| 
      
 79 
     | 
    
         
            +
                  end
         
     | 
| 
      
 80 
     | 
    
         
            +
             
     | 
| 
      
 81 
     | 
    
         
            +
                  it "returns error if no sources have that method" do
         
     | 
| 
      
 82 
     | 
    
         
            +
                    case source_class_group.concurrency_model
         
     | 
| 
      
 83 
     | 
    
         
            +
                      when :iterative
         
     | 
| 
      
 84 
     | 
    
         
            +
                        source_class_group.forward(:foo).should == {}
         
     | 
| 
      
 85 
     | 
    
         
            +
                      when :threaded
         
     | 
| 
      
 86 
     | 
    
         
            +
                        source_class_group.forward(:foo).should == nil
         
     | 
| 
      
 87 
     | 
    
         
            +
                    end
         
     | 
| 
      
 88 
     | 
    
         
            +
                    #expect { source_class_group.forward(:foo) }.to raise_error
         
     | 
| 
      
 89 
     | 
    
         
            +
                  end
         
     | 
| 
      
 90 
     | 
    
         
            +
              end
         
     | 
| 
      
 91 
     | 
    
         
            +
            end
         
     | 
| 
      
 92 
     | 
    
         
            +
             
     | 
| 
      
 93 
     | 
    
         
            +
            shared_examples_for "a source group of instance objects" do
         
     | 
| 
      
 94 
     | 
    
         
            +
              describe "forwarding to source instance objects" do
         
     | 
| 
      
 95 
     | 
    
         
            +
                  it "can set and retrieve instance variables using forward" do
         
     | 
| 
      
 96 
     | 
    
         
            +
                    expected_result = {@a=>:iv_val, @b=>:iv_val, @c=>:iv_val}
         
     | 
| 
      
 97 
     | 
    
         
            +
                    source_class_group.forward(:my_instance_var=, :iv_val).should == expected_result
         
     | 
| 
      
 98 
     | 
    
         
            +
                    source_class_group.forward(:my_instance_var).should == expected_result
         
     | 
| 
      
 99 
     | 
    
         
            +
                  end
         
     | 
| 
      
 100 
     | 
    
         
            +
             
     | 
| 
      
 101 
     | 
    
         
            +
                  it "can send parameters to instance methods" do
         
     | 
| 
      
 102 
     | 
    
         
            +
                    expected_result = {@a=>"some inst val", @b=>"some inst val", @c=>"some inst val"}
         
     | 
| 
      
 103 
     | 
    
         
            +
                    source_class_group.forward(:set_instance_method, "some inst val").should == expected_result
         
     | 
| 
      
 104 
     | 
    
         
            +
                    source_class_group.forward(:get_instance_method).should == expected_result
         
     | 
| 
      
 105 
     | 
    
         
            +
                  end
         
     | 
| 
      
 106 
     | 
    
         
            +
             
     | 
| 
      
 107 
     | 
    
         
            +
                  it "will return result as long as at least one object has that method" do
         
     | 
| 
      
 108 
     | 
    
         
            +
                    source_class_group.forward(:a_method_only).should == {@a=>:a}
         
     | 
| 
      
 109 
     | 
    
         
            +
                    source_class_group.forward(:c_method_only).should == {@c=>:c}
         
     | 
| 
      
 110 
     | 
    
         
            +
                  end
         
     | 
| 
      
 111 
     | 
    
         
            +
             
     | 
| 
      
 112 
     | 
    
         
            +
              end
         
     | 
| 
      
 113 
     | 
    
         
            +
            end
         
     | 
| 
      
 114 
     | 
    
         
            +
             
     | 
| 
      
 115 
     | 
    
         
            +
            shared_examples_for "a source group of class level objects; first_response concurrency model" do
         
     | 
| 
      
 116 
     | 
    
         
            +
              describe "forwarding to source class level objects" do
         
     | 
| 
      
 117 
     | 
    
         
            +
                  it "can set and retrieve class instance variables using forward" do
         
     | 
| 
      
 118 
     | 
    
         
            +
                    expected_result_set = {A=>:class_iv_var, B=>:class_iv_var, C=>:class_iv_var}
         
     | 
| 
      
 119 
     | 
    
         
            +
                    result = source_class_group.forward(:my_class_instance_var=, :class_iv_var)
         
     | 
| 
      
 120 
     | 
    
         
            +
                    result_key = result.keys.first
         
     | 
| 
      
 121 
     | 
    
         
            +
                    expected_result_set.keys.should include result_key
         
     | 
| 
      
 122 
     | 
    
         
            +
                    result.should == {result_key => :class_iv_var}
         
     | 
| 
      
 123 
     | 
    
         
            +
                  end
         
     | 
| 
      
 124 
     | 
    
         
            +
             
     | 
| 
      
 125 
     | 
    
         
            +
                  it "can send parameters to class methods" do
         
     | 
| 
      
 126 
     | 
    
         
            +
                    expected_result_set = {A=>"some val", B=>"some val", C=>"some val"}
         
     | 
| 
      
 127 
     | 
    
         
            +
                    result = source_class_group.forward(:set_class_method, "some val")
         
     | 
| 
      
 128 
     | 
    
         
            +
                    result_key = result.keys.first
         
     | 
| 
      
 129 
     | 
    
         
            +
                    expected_result_set.keys.should include result_key
         
     | 
| 
      
 130 
     | 
    
         
            +
                    result.should == {result_key => "some val"}
         
     | 
| 
      
 131 
     | 
    
         
            +
                  end
         
     | 
| 
      
 132 
     | 
    
         
            +
             
     | 
| 
      
 133 
     | 
    
         
            +
                  it "can get parameters from class methods" do
         
     | 
| 
      
 134 
     | 
    
         
            +
                    expected_result_set = {A=>"some val", B=>"some val", C=>"some val"}
         
     | 
| 
      
 135 
     | 
    
         
            +
                    result = source_class_group.forward(:get_class_method)
         
     | 
| 
      
 136 
     | 
    
         
            +
                    result_key = result.keys.first
         
     | 
| 
      
 137 
     | 
    
         
            +
                    expected_result_set.keys.should include result_key
         
     | 
| 
      
 138 
     | 
    
         
            +
                    result.should == {result_key => "some val"}
         
     | 
| 
      
 139 
     | 
    
         
            +
                  end
         
     | 
| 
      
 140 
     | 
    
         
            +
              end
         
     | 
| 
      
 141 
     | 
    
         
            +
            end
         
     | 
| 
      
 142 
     | 
    
         
            +
             
     | 
| 
      
 143 
     | 
    
         
            +
            shared_examples_for "a source group of instance objects; first_response concurrency model" do
         
     | 
| 
      
 144 
     | 
    
         
            +
              describe "forwarding to source instance objects" do
         
     | 
| 
      
 145 
     | 
    
         
            +
                  it "can set and retrieve instance variables using forward" do
         
     | 
| 
      
 146 
     | 
    
         
            +
                    expected_result_set = {@a=>:iv_val, @b=>:iv_val, @c=>:iv_val}
         
     | 
| 
      
 147 
     | 
    
         
            +
                    result = source_class_group.forward(:my_instance_var=, :iv_val)
         
     | 
| 
      
 148 
     | 
    
         
            +
                    result_key = result.keys.first
         
     | 
| 
      
 149 
     | 
    
         
            +
                    expected_result_set.keys.should include result_key
         
     | 
| 
      
 150 
     | 
    
         
            +
                    result.should == {result_key => :iv_val}
         
     | 
| 
      
 151 
     | 
    
         
            +
                  end
         
     | 
| 
      
 152 
     | 
    
         
            +
             
     | 
| 
      
 153 
     | 
    
         
            +
                  it "can send parameters to instance methods" do
         
     | 
| 
      
 154 
     | 
    
         
            +
                    expected_result_set = {@a=>"some inst val", @b=>"some inst val", @c=>"some inst val"}
         
     | 
| 
      
 155 
     | 
    
         
            +
                    result = source_class_group.forward(:set_instance_method, "some inst val")
         
     | 
| 
      
 156 
     | 
    
         
            +
                    result_key = result.keys.first
         
     | 
| 
      
 157 
     | 
    
         
            +
                    expected_result_set.keys.should include result_key
         
     | 
| 
      
 158 
     | 
    
         
            +
                    result.should == {result_key => "some inst val"}
         
     | 
| 
      
 159 
     | 
    
         
            +
             
     | 
| 
      
 160 
     | 
    
         
            +
                  end
         
     | 
| 
      
 161 
     | 
    
         
            +
             
     | 
| 
      
 162 
     | 
    
         
            +
                  it "can get parameters to instance methods" do
         
     | 
| 
      
 163 
     | 
    
         
            +
                    expected_result_set = {@a=>"some inst val", @b=>"some inst val", @c=>"some inst val"}
         
     | 
| 
      
 164 
     | 
    
         
            +
                    source_class_group.forward(:set_instance_method, "some inst val")
         
     | 
| 
      
 165 
     | 
    
         
            +
                    result = source_class_group.forward(:get_instance_method)
         
     | 
| 
      
 166 
     | 
    
         
            +
                    result_key = result.keys.first
         
     | 
| 
      
 167 
     | 
    
         
            +
                    expected_result_set.keys.should include result_key
         
     | 
| 
      
 168 
     | 
    
         
            +
                    result.should == {result_key => "some inst val"}
         
     | 
| 
      
 169 
     | 
    
         
            +
                  end
         
     | 
| 
      
 170 
     | 
    
         
            +
             
     | 
| 
      
 171 
     | 
    
         
            +
                  it "will return result as long as at least one object has that method" do
         
     | 
| 
      
 172 
     | 
    
         
            +
                    source_class_group.forward(:a_method_only).should == {@a=>:a}
         
     | 
| 
      
 173 
     | 
    
         
            +
                    source_class_group.forward(:c_method_only).should == {@c=>:c}
         
     | 
| 
      
 174 
     | 
    
         
            +
                  end
         
     | 
| 
      
 175 
     | 
    
         
            +
             
     | 
| 
      
 176 
     | 
    
         
            +
              end
         
     | 
| 
      
 177 
     | 
    
         
            +
            end
         
     | 
| 
      
 178 
     | 
    
         
            +
             
     | 
| 
      
 179 
     | 
    
         
            +
             
     | 
| 
      
 180 
     | 
    
         
            +
             
     | 
| 
      
 181 
     | 
    
         
            +
            describe "SourceGroup" do
         
     | 
| 
      
 182 
     | 
    
         
            +
             
     | 
| 
      
 183 
     | 
    
         
            +
              describe "initializing class objects as targets" do
         
     | 
| 
      
 184 
     | 
    
         
            +
                before(:each) do
         
     | 
| 
      
 185 
     | 
    
         
            +
                  @source_class_group = SourceGroup.new([A,B,C])
         
     | 
| 
      
 186 
     | 
    
         
            +
                end
         
     | 
| 
      
 187 
     | 
    
         
            +
             
     | 
| 
      
 188 
     | 
    
         
            +
                it "should exist" do
         
     | 
| 
      
 189 
     | 
    
         
            +
                  @source_class_group.class.should == SourceGroup
         
     | 
| 
      
 190 
     | 
    
         
            +
                end
         
     | 
| 
      
 191 
     | 
    
         
            +
              end
         
     | 
| 
      
 192 
     | 
    
         
            +
             
     | 
| 
      
 193 
     | 
    
         
            +
              describe "source group default concurrency" do
         
     | 
| 
      
 194 
     | 
    
         
            +
             
     | 
| 
      
 195 
     | 
    
         
            +
                before(:each) do
         
     | 
| 
      
 196 
     | 
    
         
            +
                  @a = A.new(:a_param); @b = B.new(:b_param); @c = C.new(:c_param)
         
     | 
| 
      
 197 
     | 
    
         
            +
                end
         
     | 
| 
      
 198 
     | 
    
         
            +
             
     | 
| 
      
 199 
     | 
    
         
            +
             
     | 
| 
      
 200 
     | 
    
         
            +
                it_should_behave_like "a source group of class level objects" do
         
     | 
| 
      
 201 
     | 
    
         
            +
                  let(:source_class_group) { SourceGroup.new([A,B,C]) }
         
     | 
| 
      
 202 
     | 
    
         
            +
                end
         
     | 
| 
      
 203 
     | 
    
         
            +
                
         
     | 
| 
      
 204 
     | 
    
         
            +
                it_should_behave_like "a source group of instance objects" do
         
     | 
| 
      
 205 
     | 
    
         
            +
                  let(:source_class_group) { SourceGroup.new([@a,@b,@c]) }
         
     | 
| 
      
 206 
     | 
    
         
            +
                end
         
     | 
| 
      
 207 
     | 
    
         
            +
              end
         
     | 
| 
      
 208 
     | 
    
         
            +
             
     | 
| 
      
 209 
     | 
    
         
            +
              describe "source group iterative concurrency" do
         
     | 
| 
      
 210 
     | 
    
         
            +
             
     | 
| 
      
 211 
     | 
    
         
            +
                before(:each) do
         
     | 
| 
      
 212 
     | 
    
         
            +
                  @a = A.new(:a_param); @b = B.new(:b_param); @c = C.new(:c_param)
         
     | 
| 
      
 213 
     | 
    
         
            +
                end
         
     | 
| 
      
 214 
     | 
    
         
            +
             
     | 
| 
      
 215 
     | 
    
         
            +
                it_should_behave_like "a source group of class level objects" do
         
     | 
| 
      
 216 
     | 
    
         
            +
                  let(:source_class_group) { SourceGroup.new([A,B,C], :iterative) }
         
     | 
| 
      
 217 
     | 
    
         
            +
                end
         
     | 
| 
      
 218 
     | 
    
         
            +
             
     | 
| 
      
 219 
     | 
    
         
            +
                it_should_behave_like "a source group of instance objects" do
         
     | 
| 
      
 220 
     | 
    
         
            +
                  let(:source_class_group) { SourceGroup.new([@a,@b,@c], :iterative) }
         
     | 
| 
      
 221 
     | 
    
         
            +
                end
         
     | 
| 
      
 222 
     | 
    
         
            +
              end
         
     | 
| 
      
 223 
     | 
    
         
            +
             
     | 
| 
      
 224 
     | 
    
         
            +
              describe "source group threaded concurrency" do
         
     | 
| 
      
 225 
     | 
    
         
            +
             
     | 
| 
      
 226 
     | 
    
         
            +
                before(:each) do
         
     | 
| 
      
 227 
     | 
    
         
            +
                  @a = A.new(:a_param); @b = B.new(:b_param); @c = C.new(:c_param)
         
     | 
| 
      
 228 
     | 
    
         
            +
                end
         
     | 
| 
      
 229 
     | 
    
         
            +
             
     | 
| 
      
 230 
     | 
    
         
            +
                it_should_behave_like "a source group of class level objects" do
         
     | 
| 
      
 231 
     | 
    
         
            +
                  let(:source_class_group) { SourceGroup.new([A,B,C], :threaded) }
         
     | 
| 
      
 232 
     | 
    
         
            +
                end
         
     | 
| 
      
 233 
     | 
    
         
            +
             
     | 
| 
      
 234 
     | 
    
         
            +
                it_should_behave_like "a source group of instance objects" do
         
     | 
| 
      
 235 
     | 
    
         
            +
                  let(:source_class_group) { SourceGroup.new([@a,@b,@c], :threaded) }
         
     | 
| 
      
 236 
     | 
    
         
            +
                end
         
     | 
| 
      
 237 
     | 
    
         
            +
              end
         
     | 
| 
      
 238 
     | 
    
         
            +
             
     | 
| 
      
 239 
     | 
    
         
            +
              describe "source group first response concurrency" do
         
     | 
| 
      
 240 
     | 
    
         
            +
             
     | 
| 
      
 241 
     | 
    
         
            +
                before(:each) do
         
     | 
| 
      
 242 
     | 
    
         
            +
                  @a = A.new(:a_param); @b = B.new(:b_param); @c = C.new(:c_param)
         
     | 
| 
      
 243 
     | 
    
         
            +
                end
         
     | 
| 
      
 244 
     | 
    
         
            +
             
     | 
| 
      
 245 
     | 
    
         
            +
                it_should_behave_like "a source group of class level objects; first_response concurrency model" do
         
     | 
| 
      
 246 
     | 
    
         
            +
                  let(:source_class_group) { SourceGroup.new([A,B,C], :first_response) }
         
     | 
| 
      
 247 
     | 
    
         
            +
                end
         
     | 
| 
      
 248 
     | 
    
         
            +
             
     | 
| 
      
 249 
     | 
    
         
            +
                it_should_behave_like "a source group of instance objects; first_response concurrency model" do
         
     | 
| 
      
 250 
     | 
    
         
            +
                  let(:source_class_group) { SourceGroup.new([@a,@b,@c], :first_response) }
         
     | 
| 
      
 251 
     | 
    
         
            +
                end
         
     | 
| 
      
 252 
     | 
    
         
            +
              end
         
     | 
| 
      
 253 
     | 
    
         
            +
             
     | 
| 
      
 254 
     | 
    
         
            +
              #TODO Build some timing tests to show benefits of threaded and first response models
         
     | 
| 
      
 255 
     | 
    
         
            +
            end
         
     | 
| 
      
 256 
     | 
    
         
            +
             
     | 
| 
      
 257 
     | 
    
         
            +
             
     | 
| 
      
 258 
     | 
    
         
            +
            #TODO Build Test Classes for the Delegator wrappers
         
     | 
| 
      
 259 
     | 
    
         
            +
             
     | 
    
        data/spec/spec_helper.rb
    ADDED
    
    | 
         @@ -0,0 +1,12 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
         
     | 
| 
      
 2 
     | 
    
         
            +
            $LOAD_PATH.unshift(File.dirname(__FILE__))
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'rspec'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'group_delegator'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            # Requires supporting files with custom matchers and macros, etc,
         
     | 
| 
      
 7 
     | 
    
         
            +
            # in ./support/ and its subdirectories.
         
     | 
| 
      
 8 
     | 
    
         
            +
            Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            RSpec.configure do |config|
         
     | 
| 
      
 11 
     | 
    
         
            +
              
         
     | 
| 
      
 12 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,152 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification 
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: group_delegator
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version 
         
     | 
| 
      
 4 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 5 
     | 
    
         
            +
              segments: 
         
     | 
| 
      
 6 
     | 
    
         
            +
              - 0
         
     | 
| 
      
 7 
     | 
    
         
            +
              - 1
         
     | 
| 
      
 8 
     | 
    
         
            +
              - 1
         
     | 
| 
      
 9 
     | 
    
         
            +
              version: 0.1.1
         
     | 
| 
      
 10 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 11 
     | 
    
         
            +
            authors: 
         
     | 
| 
      
 12 
     | 
    
         
            +
            - Dave M
         
     | 
| 
      
 13 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 14 
     | 
    
         
            +
            bindir: bin
         
     | 
| 
      
 15 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            date: 2011-03-09 00:00:00 +00:00
         
     | 
| 
      
 18 
     | 
    
         
            +
            default_executable: 
         
     | 
| 
      
 19 
     | 
    
         
            +
            dependencies: 
         
     | 
| 
      
 20 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency 
         
     | 
| 
      
 21 
     | 
    
         
            +
              name: rspec
         
     | 
| 
      
 22 
     | 
    
         
            +
              requirement: &id001 !ruby/object:Gem::Requirement 
         
     | 
| 
      
 23 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 24 
     | 
    
         
            +
                requirements: 
         
     | 
| 
      
 25 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 26 
     | 
    
         
            +
                  - !ruby/object:Gem::Version 
         
     | 
| 
      
 27 
     | 
    
         
            +
                    segments: 
         
     | 
| 
      
 28 
     | 
    
         
            +
                    - 2
         
     | 
| 
      
 29 
     | 
    
         
            +
                    - 3
         
     | 
| 
      
 30 
     | 
    
         
            +
                    - 0
         
     | 
| 
      
 31 
     | 
    
         
            +
                    version: 2.3.0
         
     | 
| 
      
 32 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 33 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 34 
     | 
    
         
            +
              version_requirements: *id001
         
     | 
| 
      
 35 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency 
         
     | 
| 
      
 36 
     | 
    
         
            +
              name: bundler
         
     | 
| 
      
 37 
     | 
    
         
            +
              requirement: &id002 !ruby/object:Gem::Requirement 
         
     | 
| 
      
 38 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 39 
     | 
    
         
            +
                requirements: 
         
     | 
| 
      
 40 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 41 
     | 
    
         
            +
                  - !ruby/object:Gem::Version 
         
     | 
| 
      
 42 
     | 
    
         
            +
                    segments: 
         
     | 
| 
      
 43 
     | 
    
         
            +
                    - 1
         
     | 
| 
      
 44 
     | 
    
         
            +
                    - 0
         
     | 
| 
      
 45 
     | 
    
         
            +
                    - 0
         
     | 
| 
      
 46 
     | 
    
         
            +
                    version: 1.0.0
         
     | 
| 
      
 47 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 48 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 49 
     | 
    
         
            +
              version_requirements: *id002
         
     | 
| 
      
 50 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency 
         
     | 
| 
      
 51 
     | 
    
         
            +
              name: jeweler
         
     | 
| 
      
 52 
     | 
    
         
            +
              requirement: &id003 !ruby/object:Gem::Requirement 
         
     | 
| 
      
 53 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 54 
     | 
    
         
            +
                requirements: 
         
     | 
| 
      
 55 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 56 
     | 
    
         
            +
                  - !ruby/object:Gem::Version 
         
     | 
| 
      
 57 
     | 
    
         
            +
                    segments: 
         
     | 
| 
      
 58 
     | 
    
         
            +
                    - 1
         
     | 
| 
      
 59 
     | 
    
         
            +
                    - 5
         
     | 
| 
      
 60 
     | 
    
         
            +
                    - 2
         
     | 
| 
      
 61 
     | 
    
         
            +
                    version: 1.5.2
         
     | 
| 
      
 62 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 63 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 64 
     | 
    
         
            +
              version_requirements: *id003
         
     | 
| 
      
 65 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency 
         
     | 
| 
      
 66 
     | 
    
         
            +
              name: rcov
         
     | 
| 
      
 67 
     | 
    
         
            +
              requirement: &id004 !ruby/object:Gem::Requirement 
         
     | 
| 
      
 68 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 69 
     | 
    
         
            +
                requirements: 
         
     | 
| 
      
 70 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 71 
     | 
    
         
            +
                  - !ruby/object:Gem::Version 
         
     | 
| 
      
 72 
     | 
    
         
            +
                    segments: 
         
     | 
| 
      
 73 
     | 
    
         
            +
                    - 0
         
     | 
| 
      
 74 
     | 
    
         
            +
                    version: "0"
         
     | 
| 
      
 75 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 76 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 77 
     | 
    
         
            +
              version_requirements: *id004
         
     | 
| 
      
 78 
     | 
    
         
            +
            description: A wrapper that allows method calls to multiple objects with various concurrency models
         
     | 
| 
      
 79 
     | 
    
         
            +
            email: dmarti21@gmail.com
         
     | 
| 
      
 80 
     | 
    
         
            +
            executables: []
         
     | 
| 
      
 81 
     | 
    
         
            +
             
     | 
| 
      
 82 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 83 
     | 
    
         
            +
             
     | 
| 
      
 84 
     | 
    
         
            +
            extra_rdoc_files: 
         
     | 
| 
      
 85 
     | 
    
         
            +
            - LICENSE.txt
         
     | 
| 
      
 86 
     | 
    
         
            +
            - README.rdoc
         
     | 
| 
      
 87 
     | 
    
         
            +
            files: 
         
     | 
| 
      
 88 
     | 
    
         
            +
            - .document
         
     | 
| 
      
 89 
     | 
    
         
            +
            - Gemfile
         
     | 
| 
      
 90 
     | 
    
         
            +
            - LICENSE.txt
         
     | 
| 
      
 91 
     | 
    
         
            +
            - README.rdoc
         
     | 
| 
      
 92 
     | 
    
         
            +
            - Rakefile
         
     | 
| 
      
 93 
     | 
    
         
            +
            - VERSION
         
     | 
| 
      
 94 
     | 
    
         
            +
            - examples/compare_to_map.rb
         
     | 
| 
      
 95 
     | 
    
         
            +
            - examples/diff_w_map.rb
         
     | 
| 
      
 96 
     | 
    
         
            +
            - examples/find_troublemakers.rb
         
     | 
| 
      
 97 
     | 
    
         
            +
            - examples/remote_component_update_sim.rb
         
     | 
| 
      
 98 
     | 
    
         
            +
            - examples/search_examples_with_benchmarks.rb
         
     | 
| 
      
 99 
     | 
    
         
            +
            - lib/group_delegator.rb
         
     | 
| 
      
 100 
     | 
    
         
            +
            - lib/group_delegator/group_delegator_instances.rb
         
     | 
| 
      
 101 
     | 
    
         
            +
            - lib/group_delegator/group_delegator_klasses.rb
         
     | 
| 
      
 102 
     | 
    
         
            +
            - lib/group_delegator/source_group.rb
         
     | 
| 
      
 103 
     | 
    
         
            +
            - lib/group_delegator/source_helper.rb
         
     | 
| 
      
 104 
     | 
    
         
            +
            - spec/group_delegator_instances_spec.rb
         
     | 
| 
      
 105 
     | 
    
         
            +
            - spec/group_delegator_klasses_spec.rb
         
     | 
| 
      
 106 
     | 
    
         
            +
            - spec/group_delegator_spec.rb
         
     | 
| 
      
 107 
     | 
    
         
            +
            - spec/source_group_spec.rb
         
     | 
| 
      
 108 
     | 
    
         
            +
            - spec/spec_helper.rb
         
     | 
| 
      
 109 
     | 
    
         
            +
            has_rdoc: true
         
     | 
| 
      
 110 
     | 
    
         
            +
            homepage: http://github.com/forforf/group_delegator
         
     | 
| 
      
 111 
     | 
    
         
            +
            licenses: 
         
     | 
| 
      
 112 
     | 
    
         
            +
            - MIT
         
     | 
| 
      
 113 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
      
 114 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 115 
     | 
    
         
            +
             
     | 
| 
      
 116 
     | 
    
         
            +
            require_paths: 
         
     | 
| 
      
 117 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 118 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement 
         
     | 
| 
      
 119 
     | 
    
         
            +
              none: false
         
     | 
| 
      
 120 
     | 
    
         
            +
              requirements: 
         
     | 
| 
      
 121 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 122 
     | 
    
         
            +
                - !ruby/object:Gem::Version 
         
     | 
| 
      
 123 
     | 
    
         
            +
                  hash: 284065555
         
     | 
| 
      
 124 
     | 
    
         
            +
                  segments: 
         
     | 
| 
      
 125 
     | 
    
         
            +
                  - 0
         
     | 
| 
      
 126 
     | 
    
         
            +
                  version: "0"
         
     | 
| 
      
 127 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement 
         
     | 
| 
      
 128 
     | 
    
         
            +
              none: false
         
     | 
| 
      
 129 
     | 
    
         
            +
              requirements: 
         
     | 
| 
      
 130 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 131 
     | 
    
         
            +
                - !ruby/object:Gem::Version 
         
     | 
| 
      
 132 
     | 
    
         
            +
                  segments: 
         
     | 
| 
      
 133 
     | 
    
         
            +
                  - 0
         
     | 
| 
      
 134 
     | 
    
         
            +
                  version: "0"
         
     | 
| 
      
 135 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 136 
     | 
    
         
            +
             
     | 
| 
      
 137 
     | 
    
         
            +
            rubyforge_project: 
         
     | 
| 
      
 138 
     | 
    
         
            +
            rubygems_version: 1.3.7
         
     | 
| 
      
 139 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 140 
     | 
    
         
            +
            specification_version: 3
         
     | 
| 
      
 141 
     | 
    
         
            +
            summary: Delegate to multiple objects concurrently
         
     | 
| 
      
 142 
     | 
    
         
            +
            test_files: 
         
     | 
| 
      
 143 
     | 
    
         
            +
            - examples/compare_to_map.rb
         
     | 
| 
      
 144 
     | 
    
         
            +
            - examples/diff_w_map.rb
         
     | 
| 
      
 145 
     | 
    
         
            +
            - examples/find_troublemakers.rb
         
     | 
| 
      
 146 
     | 
    
         
            +
            - examples/remote_component_update_sim.rb
         
     | 
| 
      
 147 
     | 
    
         
            +
            - examples/search_examples_with_benchmarks.rb
         
     | 
| 
      
 148 
     | 
    
         
            +
            - spec/group_delegator_instances_spec.rb
         
     | 
| 
      
 149 
     | 
    
         
            +
            - spec/group_delegator_klasses_spec.rb
         
     | 
| 
      
 150 
     | 
    
         
            +
            - spec/group_delegator_spec.rb
         
     | 
| 
      
 151 
     | 
    
         
            +
            - spec/source_group_spec.rb
         
     | 
| 
      
 152 
     | 
    
         
            +
            - spec/spec_helper.rb
         
     |