Skip to content

Commit

Permalink
Merge pull request #356 from mvz/support-ruby-3-and-up
Browse files Browse the repository at this point in the history
Support Ruby 3.0 and up
  • Loading branch information
mvz committed Dec 27, 2023
2 parents b5cf331 + 19313d9 commit b1dc259
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:

strategy:
matrix:
ruby: ["2.7", "3.0", "3.1", "3.2"]
ruby: ["3.0", "3.1", "3.2", "3.3"]

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -69,7 +69,7 @@ jobs:
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.2"
ruby-version: "3.3"
bundler-cache: true
- name: Run RuboCop
run: bundle exec rubocop -P
Expand Down
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ AllCops:
Exclude:
- 'examples/*'
NewCops: enable
TargetRubyVersion: 2.7
TargetRubyVersion: 3.0

# Put development dependencies in the gemspec so rubygems.org knows about them
Gemspec/DevelopmentDependencies:
Expand Down
2 changes: 1 addition & 1 deletion gir_ffi.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
DESC
spec.homepage = "http://www.github.com/mvz/ruby-gir-ffi"
spec.license = "LGPL-2.1+"
spec.required_ruby_version = ">= 2.7.0"
spec.required_ruby_version = ">= 3.0.0"

spec.metadata["homepage_uri"] = spec.homepage
spec.metadata["source_code_uri"] = "https://github.com/mvz/gir_ffi"
Expand Down
8 changes: 4 additions & 4 deletions lib/ffi-gobject/object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ class Object
[:size_t, :uint32, :pointer, :pointer],
:pointer)

def self.new_with_properties(*args, &block)
def self.new_with_properties(...)
obj = allocate
obj.__send__ :initialize_with_properties, *args, &block
obj.__send__(:initialize_with_properties, ...)
obj
end

Expand All @@ -37,9 +37,9 @@ def initialize_with_properties(properties = {})
alias_method :initialize, :initialize_with_properties
remove_method :old_initialze

def self.new(*args, &block)
def self.new(...)
obj = allocate
obj.__send__ :initialize, *args, &block
obj.__send__(:initialize, ...)
obj
end

Expand Down
4 changes: 2 additions & 2 deletions lib/gir_ffi/module_base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ module GirFFI
module ModuleBase
include MethodSetup

def method_missing(method, *arguments, &block)
def method_missing(method, ...)
result = setup_method method.to_s
return super unless result

send method, *arguments, &block
send(method, ...)
end

def respond_to_missing?(method, *)
Expand Down
4 changes: 2 additions & 2 deletions test/integration/generated_regress_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4219,7 +4219,7 @@ def make_derived_instance

it "raises an appropriate NoMethodError when a function is not found" do
result = _(proc { Regress.this_method_does_not_exist }).must_raise(NoMethodError)
_(result.message)
.must_equal "undefined method `this_method_does_not_exist' for Regress:Module"
_(result.name).must_equal :this_method_does_not_exist
_(result.receiver).must_equal Regress
end
end

0 comments on commit b1dc259

Please sign in to comment.