From 76038ba4a007d70956f997cff4913ce3e1873076 Mon Sep 17 00:00:00 2001 From: Marco Roth Date: Sun, 19 Apr 2026 14:05:06 +0900 Subject: [PATCH] Ruby: Bump Ruby minimum version to 3.2 --- .rubocop.yml | 2 +- herb.gemspec | 2 +- lib/herb.rb | 8 ++++---- lib/herb/bootstrap.rb | 1 - lib/herb/engine.rb | 2 +- lib/herb/engine/compiler.rb | 2 +- templates/template.rb | 8 ++++---- 7 files changed, 12 insertions(+), 13 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 48c105aca..54aa0e90d 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,7 +1,7 @@ AllCops: NewCops: enable SuggestExtensions: false - TargetRubyVersion: 3.0 + TargetRubyVersion: 3.2 Exclude: - 'pkg/**/*' - 'vendor/**/*' diff --git a/herb.gemspec b/herb.gemspec index c962c2899..2c21b16b6 100644 --- a/herb.gemspec +++ b/herb.gemspec @@ -17,7 +17,7 @@ Gem::Specification.new do |spec| spec.homepage = "https://herb-tools.dev" spec.license = "MIT" - spec.required_ruby_version = ">= 3.0.0" + spec.required_ruby_version = ">= 3.2.0" spec.require_paths = ["lib"] spec.files = Dir[ diff --git a/lib/herb.rb b/lib/herb.rb index ba5eaebe6..50e4a836d 100644 --- a/lib/herb.rb +++ b/lib/herb.rb @@ -69,13 +69,13 @@ module Herb class << self #: (String path, ?arena_stats: bool) -> LexResult - def lex_file(path, **options) - lex(File.read(path), **options) + def lex_file(path, **) + lex(File.read(path), **) end #: (String path, ?track_whitespace: bool, ?analyze: bool, ?strict: bool, ?arena_stats: bool) -> ParseResult - def parse_file(path, **options) - parse(File.read(path), **options) + def parse_file(path, **) + parse(File.read(path), **) end #: (String source) -> Prism::ParseResult diff --git a/lib/herb/bootstrap.rb b/lib/herb/bootstrap.rb index 57195c3f0..a51fd0280 100644 --- a/lib/herb/bootstrap.rb +++ b/lib/herb/bootstrap.rb @@ -18,7 +18,6 @@ module Bootstrap def self.generate_templates require "pathname" - require "set" require_relative "../../templates/template" Dir.chdir(ROOT_PATH) do diff --git a/lib/herb/engine.rb b/lib/herb/engine.rb index 9243e2408..fb23c7bc4 100644 --- a/lib/herb/engine.rb +++ b/lib/herb/engine.rb @@ -337,7 +337,7 @@ def add_postamble(postamble) @src << postamble end - def with_buffer(&_block) + def with_buffer(&) if @chain_appends @src << "; " << @bufvar unless @buffer_on_stack yield diff --git a/lib/herb/engine/compiler.rb b/lib/herb/engine/compiler.rb index 053a509ef..6b421bb5b 100644 --- a/lib/herb/engine/compiler.rb +++ b/lib/herb/engine/compiler.rb @@ -165,7 +165,7 @@ def visit_erb_content_node(node) process_erb_tag(node) end - def visit_erb_control_node(node, &_block) + def visit_erb_control_node(node, &) if node.content apply_trim(node, node.content.value.strip) end diff --git a/templates/template.rb b/templates/template.rb index 677a5a6d7..f425a748f 100755 --- a/templates/template.rb +++ b/templates/template.rb @@ -66,9 +66,9 @@ def prefix end class ArrayField < Field - def initialize(kind:, **options) + def initialize(kind:, **) @kind = kind - super(**options) + super(**) end def ruby_type @@ -107,9 +107,9 @@ def union_kind end class NodeField < Field - def initialize(kind:, **options) + def initialize(kind:, **) @kind = kind - super(**options) + super(**) end def c_type