Sha256: 4d63625254f4b8d7dc1647896a8dbcece5526d2044a86f02793dbefc194b18d6

Contents?: true

Size: 447 Bytes

Versions: 47

Compression:

Stored size: 447 Bytes

Contents

unless ("abc".upto("def", true){} rescue false)
  require 'backports/tools/alias_method_chain'
  require 'enumerator'

  class String
    def upto_with_exclusive(to, excl=false)
      return upto_without_exclusive(to){|s| yield s} if block_given? && !excl
      r = Range.new(self, to, excl)
      return r.to_enum unless block_given?
      r.each{|s| yield s}
      self
    end
    Backports.alias_method_chain self, :upto, :exclusive
  end
end

Version data entries

47 entries across 47 versions & 4 rubygems

Version Path
backports-3.25.0 lib/backports/1.8.7/string/upto.rb
backports-3.24.1 lib/backports/1.8.7/string/upto.rb
backports-3.24.0 lib/backports/1.8.7/string/upto.rb
backports-3.23.0 lib/backports/1.8.7/string/upto.rb
backports-3.22.1 lib/backports/1.8.7/string/upto.rb
backports-3.22.0 lib/backports/1.8.7/string/upto.rb
backports-3.21.0 lib/backports/1.8.7/string/upto.rb
backports-3.20.2 lib/backports/1.8.7/string/upto.rb
backports-3.20.1 lib/backports/1.8.7/string/upto.rb
backports-3.20.0 lib/backports/1.8.7/string/upto.rb
backports-3.19.0 lib/backports/1.8.7/string/upto.rb
backports-3.18.2 lib/backports/1.8.7/string/upto.rb
backports-3.18.1 lib/backports/1.8.7/string/upto.rb
backports-3.18.0 lib/backports/1.8.7/string/upto.rb
files.com-1.0.55 docs/vendor/bundle/ruby/2.5.0/gems/backports-3.12.0/lib/backports/1.8.7/string/upto.rb
backports-3.17.2 lib/backports/1.8.7/string/upto.rb
backports-3.17.1 lib/backports/1.8.7/string/upto.rb
backports-3.17.0 lib/backports/1.8.7/string/upto.rb
backports-3.16.1 lib/backports/1.8.7/string/upto.rb
backports-3.16.0 lib/backports/1.8.7/string/upto.rb