From 57283c4c310bbe9cf3a14b14aff0844c7e98ae7c Mon Sep 17 00:00:00 2001 From: meatball <69751659+meatball133@users.noreply.github.com> Date: Tue, 14 Jan 2025 23:26:01 +0100 Subject: [PATCH] 1.15 prep (#705) * Fixes to concept tree * Crystal 1.15 prep --- .github/workflows/doc-generator.yml | 4 ++-- .github/workflows/tests.yml | 4 ++-- README.md | 4 ++-- exercises/practice/binary-search-tree/.meta/src/example.cr | 2 +- exercises/practice/markdown/.meta/src/example.cr | 3 +-- exercises/practice/react/.meta/src/example.cr | 4 ++-- exercises/practice/strain/.meta/src/example.cr | 4 ++-- exercises/practice/word-search/.meta/src/example.cr | 2 +- 8 files changed, 13 insertions(+), 14 deletions(-) diff --git a/.github/workflows/doc-generator.yml b/.github/workflows/doc-generator.yml index c31de95c..9db25d21 100644 --- a/.github/workflows/doc-generator.yml +++ b/.github/workflows/doc-generator.yml @@ -14,7 +14,7 @@ jobs: - name: Install Crystal uses: crystal-lang/install-crystal@cdf26dcd488490c9939e9d4d62cab169c9e4f20d with: - crystal: "1.14.0" + crystal: "1.15.0" - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - name: Run generator tests run: crystal spec ./document-generator/spec/* @@ -26,7 +26,7 @@ jobs: - name: Install Crystal uses: crystal-lang/install-crystal@cdf26dcd488490c9939e9d4d62cab169c9e4f20d with: - crystal: "1.14.0" + crystal: "1.15.0" - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - name: Run generator tests run: crystal document-generator/scripts/check_docs.cr diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 33e8f0b7..3c3d94b3 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -42,7 +42,7 @@ jobs: strategy: # Allows running the job multiple times with different configurations matrix: - crystal: ["1.10", "1.11", "1.12", "1.13", "1.14.0"] + crystal: ["1.11", "1.12", "1.13", "1.14", "1.15"] container: image: crystallang/crystal:${{ matrix.crystal }} steps: @@ -58,7 +58,7 @@ jobs: - name: Install Crystal uses: crystal-lang/install-crystal@cdf26dcd488490c9939e9d4d62cab169c9e4f20d with: - crystal: "1.14.0" + crystal: "1.15.0" - name: 'Setup jq' run: choco install jq - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 diff --git a/README.md b/README.md index c190c93e..4e566df1 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@

Exercism Crystal Track

                          [![Discourse topics](https://img.shields.io/discourse/topics?color=8A08E6&label=Connect%20&labelColor=FFDF58&logo=Discourse&logoColor=8A08E6&server=https%3A%2F%2Fforum.exercism.org&style=social)](https://forum.exercism.org) - [![Exercism_II](https://img.shields.io/badge/Exercism--Built-9101FF?logo=crystal&logoColor=000000&labelColor=E5E5E5&label=Crystal%201.14.0%20Powered)](https://exercism.org) + [![Exercism_II](https://img.shields.io/badge/Exercism--Built-9101FF?logo=crystal&logoColor=000000&labelColor=E5E5E5&label=Crystal%201.15.0%20Powered)](https://exercism.org)  [![Exercism_III](https://img.shields.io/badge/Open-11b30e?labelColor=3D454D&label=Contributions)](https://exercism.org/blog/freeing-our-maintainers)  [![Build Status](https://github.com/exercism/crystal/workflows/Tests/badge.svg)](https://github.com/exercism/crystal/actions/workflows/tests.yml)
@@ -16,7 +16,7 @@ Hi.  👋🏽  👋  **We are happy you are here.**  🎉&nb **`exercism/Crystal`** is one of many programming language tracks on [exercism(dot)org][exercism-website]. This repo holds all the instructions, tests, code, & support files for Crystal _exercises_ currently under development or implemented & available for students. -🌟   Track tooling (_test-runner, representer, analyzer, and Continuous Integration_) runs on Crystal `1.14.0`.
+🌟   Track tooling (_test-runner, representer, analyzer, and Continuous Integration_) runs on Crystal `1.15.0`.
🌟   Most exercises are solvable with Crystal `1.0.0` or higher. This track is made up of **Practice Exercises**. Practice exercises are open-ended, and can be used to practice concepts learned, try out new techniques, and play. diff --git a/exercises/practice/binary-search-tree/.meta/src/example.cr b/exercises/practice/binary-search-tree/.meta/src/example.cr index ff826bd9..ee437782 100644 --- a/exercises/practice/binary-search-tree/.meta/src/example.cr +++ b/exercises/practice/binary-search-tree/.meta/src/example.cr @@ -38,7 +38,7 @@ class Node(T) end end - def each + def each(&) TreeIterator.new(self).each do |v| yield v end diff --git a/exercises/practice/markdown/.meta/src/example.cr b/exercises/practice/markdown/.meta/src/example.cr index 147b82ee..a328ebc1 100644 --- a/exercises/practice/markdown/.meta/src/example.cr +++ b/exercises/practice/markdown/.meta/src/example.cr @@ -6,8 +6,7 @@ class Markdown lines = @markdown.split("\n") lines.each_with_index do |line, index| level = line.scan(/^#+/) - # TODO: Use present? method when Crystal1.10 is dropped - if !level.empty? && level[0][0].size <= 6 + if level.present? && level[0][0].size <= 6 level = level[0][0].size result += "#{parse_line(line[(level + 1)..-1])}" elsif line.starts_with?('*') diff --git a/exercises/practice/react/.meta/src/example.cr b/exercises/practice/react/.meta/src/example.cr index 4e8914cc..651480c9 100644 --- a/exercises/practice/react/.meta/src/example.cr +++ b/exercises/practice/react/.meta/src/example.cr @@ -29,11 +29,11 @@ module React @last_callback_value : CellValue def initialize(input : Cell, &compute : CellValue -> CellValue) - initialize(->{ compute.call(input.value) }, input) + initialize(-> { compute.call(input.value) }, input) end def initialize(input1 : Cell, input2 : Cell, &compute : (CellValue, CellValue) -> CellValue) - initialize(->{ compute.call(input1.value, input2.value) }, input1, input2) + initialize(-> { compute.call(input1.value, input2.value) }, input1, input2) end private def initialize(@new_value : -> CellValue, *dependencies : Cell) diff --git a/exercises/practice/strain/.meta/src/example.cr b/exercises/practice/strain/.meta/src/example.cr index e39b4272..582a46c3 100644 --- a/exercises/practice/strain/.meta/src/example.cr +++ b/exercises/practice/strain/.meta/src/example.cr @@ -1,11 +1,11 @@ class Array(T) - def keep + def keep(&) kept = Array(T).new each { |e| kept << e if yield(e) } kept end - def discard + def discard(&) keep { |e| !yield(e) } end end diff --git a/exercises/practice/word-search/.meta/src/example.cr b/exercises/practice/word-search/.meta/src/example.cr index 16fff7f4..0d1bb3f9 100644 --- a/exercises/practice/word-search/.meta/src/example.cr +++ b/exercises/practice/word-search/.meta/src/example.cr @@ -22,7 +22,7 @@ module WordSearch results end - private def self.each_delta + private def self.each_delta(&) [-1, 0, 1].each do |dx| [-1, 0, 1].each do |dy| yield(dx, dy) if dx != 0 || dy != 0