diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f6a2976..396265b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ jobs: strategy: matrix: - ruby: ['3.2', '3.1', '3.0', '2.7'] + ruby: ['3.2', '3.1', '3.0'] frozen_string_literal: ['yes', 'no'] env: diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 6712300..ce269a9 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -39,7 +39,7 @@ jobs: - name: Set up Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: '2.7' + ruby-version: '3.0' bundler-cache: true env: BUNDLE_WITHOUT: rggen:test diff --git a/lib/rggen/core/facets.rb b/lib/rggen/core/facets.rb index 892627b..c503ce7 100644 --- a/lib/rggen/core/facets.rb +++ b/lib/rggen/core/facets.rb @@ -2,7 +2,6 @@ require 'facets/array/merge' require 'facets/file/ext' -require 'facets/hash/except' if RUBY_VERSION < '3.0.0' require 'facets/kernel/blank' require 'facets/pathname/to_path' require 'facets/module/attr_setter' diff --git a/lib/rggen/core/input_base/feature.rb b/lib/rggen/core/input_base/feature.rb index ac9a546..5ddf7d6 100644 --- a/lib/rggen/core/input_base/feature.rb +++ b/lib/rggen/core/input_base/feature.rb @@ -9,8 +9,8 @@ class Feature < Base::Feature include ConversionUtility class << self - def property(name, **options, &body) - Property.define(self, name, **options, &body) + def property(name, ...) + Property.define(self, name, ...) properties.include?(name) || properties << name end @@ -49,8 +49,8 @@ def passive_feature? builders.nil? end - def input_pattern(pattern_or_patterns, **options, &converter) - @input_matcher = InputMatcher.new(pattern_or_patterns, **options, &converter) + def input_pattern(pattern_or_patterns, ...) + @input_matcher = InputMatcher.new(pattern_or_patterns, ...) end attr_reader :input_matcher diff --git a/lib/rggen/core/input_base/input_data.rb b/lib/rggen/core/input_base/input_data.rb index 9692085..375151f 100644 --- a/lib/rggen/core/input_base/input_data.rb +++ b/lib/rggen/core/input_base/input_data.rb @@ -87,8 +87,8 @@ def include_docile_path?(caller_location) caller_location.path.include?('docile') end - def create_child_data(layer, *args, &block) - child_data_class.new(layer, @valid_value_lists, *args, &block) + def create_child_data(layer, ...) + child_data_class.new(layer, @valid_value_lists, ...) end def child_data_class diff --git a/lib/rggen/core/input_base/input_matcher.rb b/lib/rggen/core/input_base/input_matcher.rb index b7cc41d..432465f 100644 --- a/lib/rggen/core/input_base/input_matcher.rb +++ b/lib/rggen/core/input_base/input_matcher.rb @@ -52,7 +52,7 @@ def ignore_blanks? /(?<=[[:punct:]&&[^_]])[[:blank:]]+(?=\w)/ ).freeze - COMPRESS_BLANK_PATTERN = /[[:blank:]]+/.freeze + COMPRESS_BLANK_PATTERN = /[[:blank:]]+/ def delete_blanks(rhs) rhs diff --git a/lib/rggen/core/input_base/property.rb b/lib/rggen/core/input_base/property.rb index 178942d..51d2407 100644 --- a/lib/rggen/core/input_base/property.rb +++ b/lib/rggen/core/input_base/property.rb @@ -23,16 +23,16 @@ def initialize(name, options, &body) def define(feature) feature.class_exec(self) do |property| - define_method(property.name) do |*args, **keywords, &block| - property.evaluate(self, *args, **keywords, &block) + define_method(property.name) do |*args, **kwargs, &block| + property.evaluate(self, *args, **kwargs, &block) end end end - def evaluate(feature, *args, **keywords, &block) + def evaluate(feature, ...) feature.verify(@options[:verify]) if @options.key?(:verify) if proxy_property? - proxy_property(feature, *args, **keywords, &block) + proxy_property(feature, ...) else default_property(feature) end @@ -55,7 +55,7 @@ def proxy_property? ].any? end - def proxy_property(feature, *args, **keywords, &block) + def proxy_property(feature, ...) receiver, method = if @costom_property [@costom_property.bind(feature), :call] @@ -64,7 +64,7 @@ def proxy_property(feature, *args, **keywords, &block) else [feature, @options[:forward_to]] end - receiver.__send__(method, *args, **keywords, &block) + receiver.__send__(method, ...) end def default_property(feature) diff --git a/lib/rggen/core/utility/regexp_patterns.rb b/lib/rggen/core/utility/regexp_patterns.rb index fdfc29a..b955154 100644 --- a/lib/rggen/core/utility/regexp_patterns.rb +++ b/lib/rggen/core/utility/regexp_patterns.rb @@ -12,17 +12,17 @@ def included(klass) private - VARIABLE_NAME_PATTERN = /[a-z_]\w*/i.freeze + VARIABLE_NAME_PATTERN = /[a-z_]\w*/i def variable_name VARIABLE_NAME_PATTERN end - BINARY_PATTERN = /[+-]?0b[01](?:_?[01])*/i.freeze + BINARY_PATTERN = /[+-]?0b[01](?:_?[01])*/i - DECIMAL_PATTERN = /[+-]?(?:[1-9]_?(?:\d_?)*)?\d/.freeze + DECIMAL_PATTERN = /[+-]?(?:[1-9]_?(?:\d_?)*)?\d/ - HEXADECIMAL_PATTERN = /[+-]?0x\h(?:_?\h)*/i.freeze + HEXADECIMAL_PATTERN = /[+-]?0x\h(?:_?\h)*/i INTEGER_PATTERN = Regexp.union( @@ -33,13 +33,13 @@ def integer INTEGER_PATTERN end - TRUTHY_PATTERN = /true|on|yes/i.freeze + TRUTHY_PATTERN = /true|on|yes/i def truthy_pattern TRUTHY_PATTERN end - FALSEY_PATTERN = /false|off|no/i.freeze + FALSEY_PATTERN = /false|off|no/i def falsey_pattern FALSEY_PATTERN diff --git a/rggen-core.gemspec b/rggen-core.gemspec index 0128fb6..a9b9621 100644 --- a/rggen-core.gemspec +++ b/rggen-core.gemspec @@ -26,7 +26,7 @@ Gem::Specification.new do |spec| spec.executables = spec.files.grep(/^exe\//) { |f| File.basename(f) } spec.require_paths = ['lib'] - spec.required_ruby_version = '>= 2.7' + spec.required_ruby_version = '>= 3.0' spec.add_runtime_dependency 'docile', '>= 1.1.5', '!= 1.3.3' spec.add_runtime_dependency 'erubi', '>= 1.7'