Sha256: dd2e79d5a75bcb6e7b23ed708859f70641d4386a238f4f391dacd5a9ac0fe6b4

Contents?: true

Size: 340 Bytes

Versions: 10

Compression:

Stored size: 340 Bytes

Contents

module IndexShotgun
  module ArrayStartWith
    refine Array do
      def start_with?(target_array)
        return false if self.length < target_array.length

        target_array.each_with_index do |target_element, index|
          return false unless self.at(index) == target_element
        end

        true
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
index_shotgun-1.0.2 lib/index_shotgun/array_start_with.rb
index_shotgun-1.0.1 lib/index_shotgun/array_start_with.rb
index_shotgun-1.0.0 lib/index_shotgun/array_start_with.rb
index_shotgun-0.3.0 lib/index_shotgun/array_start_with.rb
index_shotgun-0.2.1 lib/index_shotgun/array_start_with.rb
index_shotgun-0.2.0 lib/index_shotgun/array_start_with.rb
index_shotgun-0.1.0 lib/index_shotgun/array_start_with.rb
index_shotgun-0.1.0.beta3 lib/index_shotgun/array_start_with.rb
index_shotgun-0.1.0.beta2 lib/index_shotgun/array_start_with.rb
index_shotgun-0.1.0.beta1 lib/index_shotgun/array_start_with.rb