Skip to content

Commit

Permalink
Bump ruby language spec to >= 3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoyne authored and cbeer committed Nov 5, 2024
1 parent 032b362 commit fac80d1
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ inherit_from:

AllCops:
DisplayCopNames: true
TargetRubyVersion: 3.0
TargetRubyVersion: 3.1
TargetRailsVersion: 7.0
Exclude:
- "lib/generators/blacklight/templates/**/*"
Expand Down
4 changes: 2 additions & 2 deletions app/helpers/blacklight/layout_helper_behavior.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ def container_classes
#
# @param [Hash] options
# @return [String]
def render_nav_actions(options = {}, &block)
render_filtered_partials(blacklight_config.navbar.partials, options, &block)
def render_nav_actions(options = {}, &)
render_filtered_partials(blacklight_config.navbar.partials, options, &)
end

##
Expand Down
4 changes: 2 additions & 2 deletions app/presenters/blacklight/facet_field_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ def values
end

# Appease rubocop rules by implementing #each_value
def each_value(&block)
values.each(&block)
def each_value(&)
values.each(&)
end

def paginator
Expand Down
2 changes: 0 additions & 2 deletions app/services/blacklight/search_params_yaml_coder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ def self.load(yaml)
params.with_indifferent_access
end

# rubocop:disable Security/YAMLLoad
if YAML.respond_to?(:unsafe_load)
def self.yaml_load(payload)
if ActiveRecord.try(:use_yaml_unsafe_load) || ActiveRecord::Base.try(:use_yaml_unsafe_load)
Expand All @@ -43,6 +42,5 @@ def self.yaml_load(payload)
end
end
end
# rubocop:enable Security/YAMLLoad
end
end
2 changes: 1 addition & 1 deletion blacklight.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Gem::Specification.new do |s|
s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
s.require_paths = ["lib"]

s.required_ruby_version = '>= 2.7'
s.required_ruby_version = '>= 3.1'

s.add_dependency "rails", '>= 7.0', '< 9'
s.add_dependency "globalid"
Expand Down
2 changes: 1 addition & 1 deletion lib/blacklight.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def self.logger= logger

# returns the full path the the blacklight plugin installation
def self.root
@root ||= File.expand_path(File.dirname(File.dirname(__FILE__)))
@root ||= File.expand_path(File.dirname(__FILE__, 2))
end

def self.deprecation
Expand Down
2 changes: 1 addition & 1 deletion lib/blacklight/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ def add_nav_action(name, opts = {})

##
# Add a section of config that only applies to documents with a matching display type
def for_display_type display_type, &_block
def for_display_type(display_type, &)
fields_for_type[display_type] ||= self.class.new

fields_for_type[display_type].tap do |conf|
Expand Down
2 changes: 1 addition & 1 deletion lib/blacklight/configuration/display_field.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module Blacklight
class Configuration::DisplayField < Blacklight::Configuration::Field
def initialize(*args, **kwargs, &block)
def initialize(*args, **kwargs, &)
super

self.presenter ||= Blacklight::FieldPresenter
Expand Down
6 changes: 3 additions & 3 deletions lib/blacklight/configuration/fields.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,15 @@ def field_type_for_class(key)
#
# add_blacklight_field :index_field, [{ :field => 'format', :label => 'Format' }, IndexField.new(:field => 'date', :label => 'Date')]
#
def add_blacklight_field config_key, *args, &block
def add_blacklight_field(config_key, *args, &)
field_config = case args.first
when String
field_config_from_key_and_hash(config_key, *args)
when Symbol
args[0] = args[0].to_s
field_config_from_key_and_hash(config_key, *args)
when Array
field_config_from_array(config_key, *args, &block)
field_config_from_array(config_key, *args, &)
return # we've iterated over the array above.
else
field_config_from_field_or_hash(config_key, *args)
Expand All @@ -101,7 +101,7 @@ def add_blacklight_field config_key, *args, &block

# look up any dynamic fields
if field_config.match
handle_matching_fields(config_key, field_config, &block)
handle_matching_fields(config_key, field_config, &)
return
end

Expand Down
8 changes: 4 additions & 4 deletions lib/blacklight/open_struct_with_hash_access.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ def deep_dup
self.class.new @table.deep_dup
end

def deep_transform_values(&method)
self.class.new @table.deep_transform_values(&method)
def deep_transform_values(&)
self.class.new @table.deep_transform_values(&)
end

def try(method_name = nil, *args, &block)
def try(method_name = nil, *args, &)
if method_name.nil? && block_given?
if b.arity.zero?
instance_eval(&block)
instance_eval(&)
else
yield self
end
Expand Down
8 changes: 4 additions & 4 deletions lib/blacklight/search_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,20 +95,20 @@ def except(*except_processor_chain)

##
# Merge additional, repository-specific parameters
def merge(extra_params, &block)
def merge(extra_params, &)
if extra_params
params_will_change!
@merged_params.merge!(extra_params.to_hash, &block)
@merged_params.merge!(extra_params.to_hash, &)
end
self
end

##
# "Reverse merge" additional, repository-specific parameters
def reverse_merge(extra_params, &block)
def reverse_merge(extra_params, &)
if extra_params
params_will_change!
@reverse_merged_params.reverse_merge!(extra_params.to_hash, &block)
@reverse_merged_params.reverse_merge!(extra_params.to_hash, &)
end
self
end
Expand Down
4 changes: 2 additions & 2 deletions lib/blacklight/solr/response/group_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ def entry_name(options)
)
end

def method_missing meth, *args, &block
def method_missing(meth, *args, &)
if response.respond_to? meth
response.send(meth, *args, &block)
response.send(meth, *args, &)
else
super
end
Expand Down

0 comments on commit fac80d1

Please sign in to comment.