From 13079eef86d7e0ae415014256d579999e64b80af Mon Sep 17 00:00:00 2001 From: Joel Drapper Date: Sat, 6 Apr 2024 02:24:45 +0100 Subject: [PATCH] Support 3.2+ --- .github/workflows/ci.yml | 9 ++------- .rubocop.yml | 8 +++++++- lib/phlex/helpers.rb | 2 -- lib/phlex/sgml.rb | 4 ++-- lib/phlex/testing/view_helper.rb | 2 +- phlex.gemspec | 2 +- test/phlex/view/capture.rb | 2 +- 7 files changed, 14 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c295e457..05bd45c7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,16 +11,11 @@ jobs: matrix: os: ["ubuntu-latest", "macos-latest"] ruby-version: - - "2.7" - - "3.0" - - "3.1" - "3.2" - "3.3" - "head" - - "truffleruby-22.2" - - "truffleruby-22.3" - - "jruby-9.4.6.0" - - "jruby-head" + - "truffleruby-23.1" + - "truffleruby-24.0" runs-on: ${{ matrix.os }} steps: diff --git a/.rubocop.yml b/.rubocop.yml index 7010023b..a3681d01 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -3,7 +3,7 @@ inherit_from: - "https://www.goodcop.style/tabs.yml" AllCops: - TargetRubyVersion: 2.7 + TargetRubyVersion: 3.2 Style/ExplicitBlockArgument: Enabled: false @@ -25,3 +25,9 @@ Naming/MethodName: Style/ReturnNilInPredicateMethodDefinition: Enabled: false + +Naming/BlockForwarding: + Enabled: false + +Style/ArgumentsForwarding: + Enabled: false diff --git a/lib/phlex/helpers.rb b/lib/phlex/helpers.rb index 0889d88f..8674ce79 100644 --- a/lib/phlex/helpers.rb +++ b/lib/phlex/helpers.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require "set" - module Phlex::Helpers private diff --git a/lib/phlex/sgml.rb b/lib/phlex/sgml.rb index 4b73bc76..39e587b7 100644 --- a/lib/phlex/sgml.rb +++ b/lib/phlex/sgml.rb @@ -397,7 +397,7 @@ def __final_attributes__(**attributes) end buffer = +"" - __build_attributes__(attributes, buffer: buffer) + __build_attributes__(attributes, buffer:) buffer end @@ -437,7 +437,7 @@ def __build_attributes__(attributes, buffer:) when Symbol then"#{name}-#{subkey.name.tr('_', '-')}" else "#{name}-#{subkey}" end - }, buffer: buffer + }, buffer: ) when Array buffer << " " << name << '="' << Phlex::Escape.html_escape(v.compact.join(" ")) << '"' diff --git a/lib/phlex/testing/view_helper.rb b/lib/phlex/testing/view_helper.rb index 310b7b8a..9a6b308b 100644 --- a/lib/phlex/testing/view_helper.rb +++ b/lib/phlex/testing/view_helper.rb @@ -7,7 +7,7 @@ def render(view, &block) view = view.new end - view.call(view_context: view_context, &block) + view.call(view_context:, &block) end def view_context diff --git a/phlex.gemspec b/phlex.gemspec index 972dfc0a..c0f0679d 100644 --- a/phlex.gemspec +++ b/phlex.gemspec @@ -12,7 +12,7 @@ Gem::Specification.new do |spec| spec.description = "A high-performance view framework optimised for fun." spec.homepage = "https://www.phlex.fun" spec.license = "MIT" - spec.required_ruby_version = ">= 2.7" + spec.required_ruby_version = ">= 3.2" spec.metadata["homepage_uri"] = spec.homepage spec.metadata["source_code_uri"] = "https://github.com/phlex-ruby/phlex" diff --git a/test/phlex/view/capture.rb b/test/phlex/view/capture.rb index 3e9a6b24..68e456be 100644 --- a/test/phlex/view/capture.rb +++ b/test/phlex/view/capture.rb @@ -76,7 +76,7 @@ def view_template def view_template srcdoc = capture { yield } if block_given? - iframe srcdoc: srcdoc + iframe srcdoc: end end end