Sha256: f0691417b226f351a69ad211243099b39eed3973084fb6fa42e29e9d65202b27

Contents?: true

Size: 446 Bytes

Versions: 18

Compression:

Stored size: 446 Bytes

Contents

module GitlabAwesomeRelease
  module ArrayWithinExt
    refine Array do
      def within(from_value, to_value)
        from_index = find_index(from_value)
        to_index   = find_index(to_value)

        raise ArgumentError, "#{from_value} is not included in #{inspect}" unless from_index
        raise ArgumentError, "#{to_value} is not included in #{inspect}"   unless to_index

        self[from_index..to_index]
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
gitlab_awesome_release-1.1.1 lib/gitlab_awesome_release/array_within_ext.rb
gitlab_awesome_release-1.1.0 lib/gitlab_awesome_release/array_within_ext.rb
gitlab_awesome_release-1.0.4 lib/gitlab_awesome_release/array_within_ext.rb
gitlab_awesome_release-1.0.3 lib/gitlab_awesome_release/array_within_ext.rb
gitlab_awesome_release-1.0.2 lib/gitlab_awesome_release/array_within_ext.rb
gitlab_awesome_release-1.0.1 lib/gitlab_awesome_release/array_within_ext.rb
gitlab_awesome_release-1.0.0 lib/gitlab_awesome_release/array_within_ext.rb
gitlab_awesome_release-0.1.2 lib/gitlab_awesome_release/array_within_ext.rb
gitlab_awesome_release-0.1.1 lib/gitlab_awesome_release/array_within_ext.rb
gitlab_awesome_release-0.1.0 lib/gitlab_awesome_release/array_within_ext.rb
gitlab_awesome_release-0.1.0.beta8 lib/gitlab_awesome_release/array_within_ext.rb
gitlab_awesome_release-0.1.0.beta7 lib/gitlab_awesome_release/array_within_ext.rb
gitlab_awesome_release-0.1.0.beta6 lib/gitlab_awesome_release/array_within_ext.rb
gitlab_awesome_release-0.1.0.beta5 lib/gitlab_awesome_release/array_within_ext.rb
gitlab_awesome_release-0.1.0.beta4 lib/gitlab_awesome_release/array_within_ext.rb
gitlab_awesome_release-0.1.0.beta3 lib/gitlab_awesome_release/array_within_ext.rb
gitlab_awesome_release-0.1.0.beta2 lib/gitlab_awesome_release/array_within_ext.rb
gitlab_awesome_release-0.1.0.beta1 lib/gitlab_awesome_release/array_within_ext.rb