Skip to content

Commit

Permalink
drop Ruby 2.7
Browse files Browse the repository at this point in the history
  • Loading branch information
taichi-ishitani committed Dec 20, 2023
1 parent 9800ad2 commit 17843a4
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion lib/rggen/core/facets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
8 changes: 4 additions & 4 deletions lib/rggen/core/input_base/feature.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/rggen/core/input_base/input_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/rggen/core/input_base/input_matcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions lib/rggen/core/input_base/property.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]
Expand All @@ -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)
Expand Down
12 changes: 6 additions & 6 deletions lib/rggen/core/utility/regexp_patterns.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion rggen-core.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit 17843a4

Please sign in to comment.