Skip to content

Commit

Permalink
Merge pull request #100 from simplybusiness/ruby-3-4-support
Browse files Browse the repository at this point in the history
Update Ruby version requirements and logger method signatures
  • Loading branch information
addersuk authored Jan 17, 2025
2 parents d4515ae + 17dcde3 commit 3ed799f
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

strategy:
matrix:
ruby-version: [3.0, 3.1, 3.2, 3.3]
ruby-version: [3.1, 3.2, 3.3, 3.4]

steps:
- uses: actions/checkout@v4
Expand Down
6 changes: 4 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
inherit_gem:
simplycop: .simplycop.yml
simplycop:
- .simplycop.yml
- .simplycop_performance.yml

AllCops:
TargetRubyVersion: 3.0
TargetRubyVersion: 3.1

Metrics/BlockLength:
Max: 250
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.2.2
3.4.1
22 changes: 11 additions & 11 deletions lib/twiglet/logger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,25 @@ def configure_validation_error_response(&block)
@validator.custom_error_handler = block
end

def debug(message_or_error = nil, &block)
def debug(message_or_error = nil, &)
message = message_or_error.is_a?(Exception) ? error_message(message_or_error) : message_or_error

super(message, &block)
super(message, &)
end

def info(message_or_error = nil, &block)
def info(message_or_error = nil, &)
message = message_or_error.is_a?(Exception) ? error_message(message_or_error) : message_or_error

super(message, &block)
super(message, &)
end

def warn(message_or_error = nil, &block)
def warn(message_or_error = nil, &)
message = message_or_error.is_a?(Exception) ? error_message(message_or_error) : message_or_error

super(message, &block)
super(message, &)
end

def error(message_or_error = nil, error = nil, &block)
def error(message_or_error = nil, error = nil, &)
message = if error
error_message(error, message_or_error)
elsif message_or_error.is_a?(Exception)
Expand All @@ -71,20 +71,20 @@ def error(message_or_error = nil, error = nil, &block)
message_or_error
end

super(message, &block)
super(message, &)
end

def with(default_properties)
self.class.new(
@service_name,
**@args.merge(default_properties: default_properties)
**@args, default_properties: default_properties
)
end

def validation_schema(validation_schema)
self.class.new(
@service_name,
**@args.merge(validation_schema: validation_schema)
**@args, validation_schema: validation_schema
)
end

Expand All @@ -94,7 +94,7 @@ def context_provider(&blk)

self.class.new(
@service_name,
**@args.merge(context_providers: new_context_providers)
**@args, context_providers: new_context_providers
)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/twiglet/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Twiglet
VERSION = '3.13.5'
VERSION = '3.14.0'
end
2 changes: 1 addition & 1 deletion test/logger_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
:level=,
:sev_threshold=
].each do |call|
assert @logger.respond_to?(call), "Logger does not respond to #{call}"
assert_respond_to @logger, call, "Logger does not respond to #{call}"
end
end

Expand Down
2 changes: 1 addition & 1 deletion twiglet.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Gem::Specification.new do |gem|
gem.files = `git ls-files`.split("\n")

gem.require_paths = ['lib']
gem.required_ruby_version = '>= 3.0'
gem.required_ruby_version = ['>= 3.1 ', '< 3.5']

gem.license = 'Copyright SimplyBusiness'

Expand Down

0 comments on commit 3ed799f

Please sign in to comment.