Prep for Ruby 3.1

This commit is contained in:
Marc-Andre Lafortune 2021-12-06 23:46:38 -05:00 committed by Marc-André Lafortune
parent 5db1be8bc0
commit aec58b2bad
6 changed files with 15 additions and 10 deletions

View File

@ -13,8 +13,8 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ ubuntu ]
ruby: [ 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, head ]
os: [ubuntu]
ruby: [2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 3.0, head]
steps:
- name: checkout
uses: actions/checkout@v2
@ -27,7 +27,7 @@ jobs:
- name: install specs
run: git submodule update --init --recursive
- name: spec
run: bundle exec rake test all_spec
run: bundle exec rake test all_spec
internal_investigation:
name: >-
Coding Style
@ -37,8 +37,8 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ ubuntu ]
ruby: [ 2.7 ]
os: [ubuntu]
ruby: [2.7]
steps:
- name: checkout
uses: actions/checkout@v2

View File

@ -1,6 +1,6 @@
# Backports Library [<img src="https://travis-ci.org/marcandre/backports.svg?branch=master">](https://travis-ci.org/marcandre/backports) [<img src="https://badge.fury.io/rb/backports.svg" alt="Gem Version" />](http://badge.fury.io/rb/backports) [![Tidelift](https://tidelift.com/badges/package/rubygems/backports)](https://tidelift.com/subscription/pkg/rubygems-backports?utm_source=rubygems-backports&utm_medium=referral&utm_campaign=readme)
Yearning to write a gem using some new cool features in Ruby 3.0 while
Yearning to write a gem using some new cool features in Ruby 3.1 while
still supporting Ruby 2.5.x?
Have some legacy code in Ruby 1.8 but can't live without `flat_map`?
@ -38,12 +38,12 @@ This will make sure that Hash responds to `dig`, `fetch_values`, `to_proc` and c
### Up to a specific Ruby version (for quick coding)
You can load all backports up to a specific version.
For example, to bring any version of Ruby mostly up to Ruby 3.0.0's standards:
For example, to bring any version of Ruby mostly up to Ruby 3.1.0's standards:
require 'backports/3.0.0'
require 'backports/3.1.0'
This will bring in all the features of 1.8.7 and many features of Ruby 1.9.x
all the way up to Ruby 3.0.0 (for all versions of Ruby)!
all the way up to Ruby 3.1.0 (for all versions of Ruby)!
You may `require 'backports/latest'` as a
shortcut to the latest Ruby version supported.

3
lib/backports/3.1.0.rb Normal file
View File

@ -0,0 +1,3 @@
# require this file to load all the backports up to Ruby 3.0
require 'backports/3.0.0'
Backports.require_relative_dir if RUBY_VERSION < '3.1'

1
lib/backports/3.1.rb Normal file
View File

@ -0,0 +1 @@
require 'backports/3.1.0'

View File

@ -1,4 +1,4 @@
# require this file to load all the backports
# NOTE: This is NOT recommended.
# Best to require the specific backports you need
require 'backports/2.7.0'
require 'backports/3.1.0'

1
set_version/3.1.0.rb Normal file
View File

@ -0,0 +1 @@
require File.expand_path("#{File.dirname(__FILE__)}/setter")