Elementor

Elementor is an Array which applies calls elementwise. Depending on the mode the call will return a new elementor, the same elementor, a new array, or the orignal array transformed.

Methods
Public Class methods
new( an_array, mode=nil )
# File lib/facets/more/elementor.rb, line 33
  def initialize( an_array, mode=nil )
    @array = an_array
    @mode = mode
  end
Public Instance methods
each( *args, &block )
# File lib/facets/more/elementor.rb, line 41
  def each( *args, &block )
    @array.each( *args, &block )
  end
method_missing( sym, *args, &block )
# File lib/facets/more/elementor.rb, line 45
  def method_missing( sym, *args, &block )
    case @mode
      when :array
        @array.collect { |e| e.send( sym, *args, &block ) }
      when :inplace_array
        @array.collect! { |e| e.send( sym, *args, &block ) }
        @array
      when :inplace
        c = @array.collect { |e| e.send( sym, *args, &block ) }
        @array.replace( c )
        self
      else
        c = @array.collect { |e| e.send( sym, *args, &block ) }
        self.__class__.new( c )
    end
  end
to_a()
# File lib/facets/more/elementor.rb, line 38
  def to_a ; @array ; end
to_ary()
# File lib/facets/more/elementor.rb, line 39
  def to_ary ; @array ; end