Sha256: 996009e6a1b0f0f7a06b88da9363ef6f227ca16b068d80d016a8b7234b829a60

Contents?: true

Size: 373 Bytes

Versions: 8

Compression:

Stored size: 373 Bytes

Contents

class Regexp
  # Standard in Ruby 1.8.8. See official documentation[http://ruby-doc.org/core-1.9/classes/Array.html]
  class << self
    def try_convert(obj)
      case
        when obj.is_a?(Regexp)
          obj
        when obj.respond_to?(:to_regexp)
          Backports.coerce_to(obj, Regexp, :to_regexp)
      end
    end unless method_defined? :try_convert
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
backports-2.3.0 lib/backports/1.9.1/regexp.rb
backports-2.2.1 lib/backports/1.9.1/regexp.rb
backports-2.2.0 lib/backports/1.9.1/regexp.rb
backports-2.1.0 lib/backports/1.8.8/regexp.rb
backports-2.0.3 lib/backports/1.8.8/regexp.rb
backports-2.0.2 lib/backports/1.8.8/regexp.rb
backports-2.0.1 lib/backports/1.8.8/regexp.rb
backports-2.0.0 lib/backports/1.8.8/regexp.rb