Sha256: cb7615c6fa528a0fe420234a6b8809143ce34ce1a950e9aff6ff5f06fc9c7578

Contents?: true

Size: 234 Bytes

Versions: 11

Compression:

Stored size: 234 Bytes

Contents

class Array
  def starts_with?(prefix)
    return true if prefix.empty?
    return false if prefix.size > size
    prefix.each_with_index do |element, index|
      return false unless self[index] == element
    end
    true
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
coolerator.vision-0.2.10 spec/support/vendor/screw-unit/lib/screw_unit/array_extension.rb
coolerator.vision-0.2.9 spec/support/vendor/screw-unit/lib/screw_unit/array_extension.rb
coolerator.vision-0.2.8 spec/support/vendor/screw-unit/lib/screw_unit/array_extension.rb
coolerator.vision-0.2.7 spec/support/vendor/screw-unit/lib/screw_unit/array_extension.rb
coolerator.vision-0.2.6 spec/support/vendor/screw-unit/lib/screw_unit/array_extension.rb
coolerator.vision-0.2.5 spec/support/vendor/screw-unit/lib/screw_unit/array_extension.rb
coolerator.vision-0.2.4 spec/support/vendor/screw-unit/lib/screw_unit/array_extension.rb
coolerator.vision-0.2.3 spec/support/vendor/screw-unit/lib/screw_unit/array_extension.rb
coolerator.vision-0.2.2 spec/support/vendor/screw-unit/lib/screw_unit/array_extension.rb
coolerator.vision-0.2.1 spec/support/vendor/screw-unit/lib/screw_unit/array_extension.rb
coolerator.vision-0.2.0 spec/support/vendor/screw-unit/lib/screw_unit/array_extension.rb