Sha256: 2ace4bd39508a56840d9c9b74f23c9c5ca0f5f3d927900f7bea198ff3ac05f28

Contents?: true

Size: 361 Bytes

Versions: 14

Compression:

Stored size: 361 Bytes

Contents

class VariableArray < Array
  def ==(other)
    if other.is_a?(Array)
      comp = self[1..(self.length - 1)]
      return comp.first == other.first
    else
      super
    end
  end
  def collect(&block)
    self.class.new.tap do |ret|
      self.each_with_index do |el, i|
        ret[i] = block.call(el)
      end
    end
  end
  alias_method :eql?, :==
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
hash_dealer-1.6.2 lib/variable_array.rb
hash_dealer-1.6.1 lib/variable_array.rb
hash_dealer-1.6.0 lib/variable_array.rb
hash_dealer-1.5.2 lib/variable_array.rb
hash_dealer-1.5.1 lib/variable_array.rb
hash_dealer-1.5.0 lib/variable_array.rb
hash_dealer-1.4.10 lib/variable_array.rb
hash_dealer-1.4.9 lib/variable_array.rb
hash_dealer-1.4.8 lib/variable_array.rb
hash_dealer-1.4.7 lib/variable_array.rb
hash_dealer-1.4.6 lib/variable_array.rb
hash_dealer-1.4.5 lib/variable_array.rb
hash_dealer-1.4.4 lib/variable_array.rb
hash_dealer-1.4.3 lib/variable_array.rb