Skip to content

Commit

Permalink
Merge branch 'master' into add_pattern_matching
Browse files Browse the repository at this point in the history
  • Loading branch information
ohai committed May 31, 2024
2 parents 497a461 + ffa4e71 commit 4bb59c0
Show file tree
Hide file tree
Showing 78 changed files with 1,903 additions and 1,004 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: 'weekly'
30 changes: 20 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- id: versions
run: |
versions=$(curl -s 'https://cache.ruby-lang.org/pub/misc/ci_versions/cruby.json' | jq -c '. + []')
echo "::set-output name=value::${versions}"
echo "value=${versions}" >> $GITHUB_OUTPUT
rake:
needs: ruby-versions
Expand All @@ -20,13 +20,18 @@ jobs:
os: [ubuntu-latest, macos-latest, windows-latest]
ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
exclude:
- os: windows-latest
ruby: '3.2'
- os: macos-latest
- os: windows-latest
include:
- os: macos-latest
ruby: head
- os: windows-latest
ruby: head

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
Expand All @@ -53,7 +58,7 @@ jobs:
ls -Name "*.*" | foreach {
tar acf "../artifact/${_}.tar.xz" $_
}
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
name: statichtml-${{ matrix.os }}-${{ matrix.ruby }}
path: /tmp/artifact/*.*.tar.xz
Expand All @@ -62,29 +67,34 @@ jobs:
run: |
cd /tmp
mv -v html html.pr
- uses: actions/checkout@v2
- name: Checkout base
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.base.sha }}
- name: Install dependencies
- name: Install dependencies (base)
run: bundle install
- name: Run rake
- name: Run rake (base)
run: bundle exec rake
id: generate_base
continue-on-error: true
- name: Rename generated html and generate diff
run: |
cd /tmp
mv -v html html.base
git diff --no-index html.base html.pr --stat || true
git diff --no-index html.base html.pr --output artifact/html.diff || true
- uses: actions/upload-artifact@v2
if: ${{ steps.generate_base.outcome == 'success' }}
- uses: actions/upload-artifact@v4
with:
name: diff-${{ matrix.os }}-${{ matrix.ruby }}
path: /tmp/artifact/html.diff
if: ${{ steps.generate_base.outcome == 'success' }}

misspell:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Install misspell
run: 'curl -L https://git.io/misspell | bash'
- name: Run misspell
Expand Down
9 changes: 6 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# coding: utf-8
OLD_VERSIONS = %w[1.8.7 1.9.3 2.0.0 2.1.0 2.2.0 2.3.0 2.4.0 2.5.0 2.6.0]
SUPPORTED_VERSIONS = %w[2.7.0 3.0 3.1 3.2]
UNRELEASED_VERSIONS = %w[3.3]
OLD_VERSIONS = %w[
1.8.7 1.9.3
2.0.0 2.1.0 2.2.0 2.3.0 2.4.0 2.5.0 2.6.0 2.7.0
]
SUPPORTED_VERSIONS = %w[3.0 3.1 3.2 3.3]
UNRELEASED_VERSIONS = %w[3.4]
ALL_VERSIONS = [*OLD_VERSIONS, *SUPPORTED_VERSIONS, *UNRELEASED_VERSIONS]
CI_VERSIONS = [*SUPPORTED_VERSIONS, *UNRELEASED_VERSIONS]
HTML_DIRECTORY_BASE = ENV.fetch("HTML_DIRECTORY_BASE", "/tmp/html/")
Expand Down
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# usage:
#
# docker-compose build
# docker-compose run --rm rurema rake -T
# docker-compose run --rm rurema rake generate:2.7.0 statichtml:2.7.0
# docker compose build
# docker compose run --rm rurema rake -T
# docker compose run --rm rurema rake generate:2.7.0 statichtml:2.7.0
# open _site/2.7.0/index.html instead of /tmp/html/2.7.0/index.html
version: "3.8"
services:
Expand Down
1 change: 1 addition & 0 deletions refm/api/src/LIBRARIES
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ rake/tasklib
rake/testtask
rake/loaders/makefile
rbconfig
rbconfig/sizeof
rdoc
rdoc/code_objects
rdoc/alias
Expand Down
5 changes: 4 additions & 1 deletion refm/api/src/_builtin.rd
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ require を書かなくても使うことができます。
#@since 2.3.0
#@include(thread/ConditionVariable)
#@end
#@until 3.0.0
#@until 2.7.0
#@include(_builtin/Data.old)
#@end
#@since 3.2
#@include(_builtin/Data)
#@end
#@include(_builtin/Dir)
Expand Down
2 changes: 1 addition & 1 deletion refm/api/src/_builtin/ARGF
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ ARGF の現在位置から 1 バイトずつ読み込み、それを整数とし
# "2"
# "\n"

@see [[m:IO#each_char]], [[m:IO#chars]]
@see [[m:IO#each_char]]

#@until 3.0
--- chars { |c| ... } -> self
Expand Down
27 changes: 16 additions & 11 deletions refm/api/src/_builtin/Array
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,11 @@ a[10] #=> nil
--- [](range) -> Array | nil

[[c:Range]] オブジェクト range の範囲にある要素からなる部分配列を返します。
range の first の値が配列の範囲に収まらない場合 nil を返します。
range の first が end より後にある場合には空の配列を返します。
range の begin が自身の範囲外となる時は nil を返します。ただし、begin が配列の長さに等しいときは空の配列を返します
range の begin が end より後にある場合には空の配列を返します。

@param range 生成したい部分配列の範囲を [[c:Range]] オブジェクトで指定します。
range の first や end の値が負の時には末尾からのインデックスと見倣します。末尾
range の begin や end の値が負の時には末尾からのインデックスと見倣します。末尾
の要素が -1 番目になります。
end の値が配列の範囲を越える時には、越えた分は無視されます。

Expand All @@ -157,16 +157,16 @@ a[10..11] #=> nil
a[2..1] #=> []
a[-1..-2] #=> []

# 特殊なケース。first が自身の長さと同じ場合には以下のようになります。
a[5] #=> nil
a[5, 1] #=> []
a[5..10] #=> []
# 特殊なケース。begin が自身の長さと同じ場合には以下のようになります。
a[5] #=> nil
a[5..10] #=> []
#@end

--- [](start, length) -> Array | nil

start 番目から length 個の要素を含む部分配列を返します。
length が負の時、start が自身の範囲を越えた時には nil を返します。
start が自身の範囲外となる時は nil を返します。ただし、start が配列の長さに等しいときは空の配列を返します。
length が負の時は nil を返します。

@param start 生成したい部分配列の先頭のインデックスを整数で指定します。
start の値が負の時には末尾からのインデックスと見倣します。
Expand All @@ -193,9 +193,8 @@ a[0, -1] #=> nil
a[10, 1] #=> nil

# 特殊なケース。start が自身の長さと同じ場合には以下のようになります。
a[5] #=> nil
a[5, 1] #=> []
a[5..10] #=> []
a[5] #=> nil
a[5, 1] #=> []
#@end

--- []=(nth, val)
Expand Down Expand Up @@ -580,6 +579,8 @@ other に配列以外のオブジェクトを指定した場合は nil を返し
が真である場合に true を返します。ブロックが偽を返した時点で、
ただちに false を返します。

要素の数が 0 である配列に対しては true を返します。

@param pattern ブロックの代わりに各要素に対して pattern === item を評価します。

#@samplecode 例
Expand Down Expand Up @@ -607,6 +608,8 @@ p %w[ant bear cat].all?(/t/) # => false
が偽である場合に false を返します。ブロックが真を返した時点
で、ただちに true を返します。

要素の数が 0 である配列に対しては false を返します。

#@since 2.5.0
@param pattern ブロックの代わりに各要素に対して pattern === item を評価します。
#@end
Expand Down Expand Up @@ -1492,6 +1495,8 @@ p [1, nil, 3, nil].nitems{|e| e == 1} #=> 2
ブロックで評価した結果が、すべて偽であれば真を返します。
そうでなければ偽を返します。

要素の数が 0 である配列に対しては true を返します。

@param pattern ブロックの代わりに各要素に対して pattern === item を評価します。

#@samplecode 例
Expand Down
2 changes: 1 addition & 1 deletion refm/api/src/_builtin/Binding
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
ローカル変数のテーブルと self、モジュールのネストなどの情報を保
持するオブジェクトのクラスです。

組み込み関数 [[m:Kernel.#binding]] によっ
組み込み関数 [[m:Kernel.#binding]] と [[m:Proc#binding]] によっ
てのみ生成され、[[m:Kernel.#eval]] の第 2 引数に使用します。
またトップレベルの Binding オブジェクトとして組み込み定数
[[m:Object::TOPLEVEL_BINDING]] が用意されています。
Expand Down
13 changes: 13 additions & 0 deletions refm/api/src/_builtin/Comparable
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ self <=> min が負数を返したときは min を、
self <=> max が正数を返したときは max を、
それ以外の場合は self を返します。

#@since 3.0
min が nil の場合、min は self よりも小さい値として扱われます。
max が nil の場合、max は self よりも大きい値として扱われます。
#@end

#@since 2.7.0
range が1つ渡された場合は次のようになります。
self <=> range.begin が負数を返したときは range.begin を、
Expand Down Expand Up @@ -155,6 +160,14 @@ range.end が nil の場合、range.end は self よりも大きい値として
'z'.clamp('a', 'f') #=> 'f'
#@end

#@since 3.0
#@samplecode nil を渡す例
5.clamp(0, nil) #=> 5
5.clamp(nil, 0) #=> 0
5.clamp(nil, nil) #=> 5
#@end
#@end

#@since 2.7.0
#@samplecode range を渡す例
12.clamp(0..100) #=> 12
Expand Down
Loading

0 comments on commit 4bb59c0

Please sign in to comment.