Question: I have an enumerable that goes through several transformation steps and a final filter step

E.g

```
[1,2,3,4,5,6,7,8,9].map{|i| i * 2}
                   .map{|i| i * i}
                   .filter{|i| i % 3 ==0 }
                   .each{|i| puts how_do_i_get_initial_value_here }
                   .or_the_initial_value_here

```

How do I get the initial value whose transformations satisfied the filter?

Thus in the above example, how do I end up with `[3,6,9]` instead of `[36, 144, 324]`

Answer: 
You need to carry original value to the final step. 

Object-oriented approach can help by introducing a "filter" type

```
class Filter
  attr_reader :value

  def initialize(value)
    @value = value 
  end

  def satisfies?
    (value * 2 * value) % 3 == 0
  end
end

```

Usage

```
[1,2,3,4,5,6,7,8,9].map { |i| Filter.new(i) }.select(&:satisfies?).map(&:value)

```
You could just undo the things you did. So 

```
[1,2,3,4,5,6,7,8,9]
  .map{ |i| i * 2 }
  .map{ |i| i * i }
  .filter{ |i| i % 3 ==0 }
  .map{ |i| Math.sqrt(i) / 2 }

```