title: Iterate through an array of one class object and put those elements into an array belonging to another class object with Ruby.
body: <p>Let's say I have two classes:</p>
  
  <pre><code>class One
    attr_reader :array
    def initialize(array)
      @array = array
    end
  end
  
  class Two &lt; One
    attr_reader :array
    def initialize
      @array = []
    end
  end
  </code></pre>
  
  <p>I now instantiate one object of class "One" and two objects from class "Two".</p>
  
  <pre><code>array = ["D","E"] 
  a = One.new(array)
  b = Two.new
  c = Two.new
  </code></pre>
  
  <p>Is it possible to create a method situated inside the One class that accepts two arguments such that if the string exists in One @array, copy that element put that element in the array of a specified array belonging to Two class?</p>
  
  <pre><code>Example:
  
  def place_string(element,location)
    if location == "b"
      take element, copy it and place it into @array in b
    elsif location == "c"
      take element, copy it and place it into @array in c
    end
  end
  a.place_string("D","b")
  a.place_string("E","c")
  
  Output:
    a.array = ["D","E"]
    b.array = ["D"]
    c.array = ["E"]
  </code></pre>