First, refer to the previous "Trying Cocoa from Ruby". https://qiita.com/KoichiroEto/items/3e408e1420171f97fe61
When I run it, I get a warning.
% ruby test1.rb /usr/local/lib/ruby/gems/2.7.0/gems/cocoa-0.1.6/lib/cocoa/objc/method_def.rb:154: warning: constant ::Fixnum is deprecated /usr/local/lib/ruby/gems/2.7.0/gems/cocoa-0.1.6/lib/cocoa/objc/method_def.rb:154: warning: constant ::Fixnum is deprecated /usr/local/lib/ruby/gems/2.7.0/gems/cocoa-0.1.6/lib/cocoa/objc/method_def.rb:154: warning: constant ::Bignum is deprecated
If you change Fixnum and Bignum to Integer as shown below, no warning will be issued.
% cd /usr/local/lib/ruby/gems/2.7.0/gems/cocoa-0.1.6/lib/cocoa/objc
% cp method_def.rb method_def.rb.org
% vi method_def.rb
% diff method_def.rb.org method_def.rb
154c154
< when Fixnum, Bignum
---
> when Integer
reference:
It's a big deal, so let's pull it.
--Display https://github.com/patrickhno/cocoa/. --Fork → eto on the upper right. --Then, https://github.com/eto/cocoa will be created.
% cd ~/dev % git clone https://github.com/eto/cocoa.git % cd cocoa % git status On branch master Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
% git checkout -b develop Switched to a new branch 'develop'
% cd lib/cocoa/objc % vi method_def.rb
Check for corrections.
% git diff diff --git a/lib/cocoa/objc/method_def.rb b/lib/cocoa/objc/method_def.rb index c588790..21779ba 100644 --- a/lib/cocoa/objc/method_def.rb +++ b/lib/cocoa/objc/method_def.rb @@ -177,7 +177,7 @@ module ObjC case value when TrueClass, FalseClass [:bool,value]
when Fixnum, Bignum
when Integer [TYPES[types[i]],value] when Float [:double,value]
% git add method_def.rb % git commit -m "Fix 'warning: constant ::Fixnum, Bignum is deprecated'." [master fdfaa0e] Fix 'warning: constant ::Fixnum, Bignum is deprecated'. 1 file changed, 1 insertion(+), 1 deletion(-)
% git push origin develop Enumerating objects: 11, done. Counting objects: 100% (11/11), done. Delta compression using up to 8 threads Compressing objects: 100% (5/5), done. Writing objects: 100% (6/6), 526 bytes | 526.00 KiB/s, done. Total 6 (delta 3), reused 0 (delta 0) remote: Resolving deltas: 100% (3/3), completed with 3 local objects. remote: remote: Create a pull request for 'develop' on GitHub by visiting: remote: https://github.com/eto/cocoa/pull/new/develop remote: To https://github.com/eto/cocoa.git
- [new branch] develop -> develop
--Display https://github.com/eto/cocoa. --Go to "master" and select "develop". --https://github.com/eto/cocoa/blob/develop/lib/cocoa/objc/method_def.rb → Line 180 has been corrected. --Press "Pull request" to the right of "This branch is 1 commit ahead of patrickhno: master." --Leave a comment in "Leave a comment".
This pull request fixes the following warnings.
> /usr/local/lib/ruby/gems/2.7.0/gems/cocoa-0.1.6/lib/cocoa/objc/method_def.rb:154: warning: constant ::Fixnum is deprecated
> /usr/local/lib/ruby/gems/2.7.0/gems/cocoa-0.1.6/lib/cocoa/objc/method_def.rb:154: warning: constant ::Fixnum is deprecated
> /usr/local/lib/ruby/gems/2.7.0/gems/cocoa-0.1.6/lib/cocoa/objc/method_def.rb:154: warning: constant ::Bignum is deprecated
--Press "Create pull request". --Transition to the following page. You have now created a pull request. https://github.com/patrickhno/cocoa/pull/6
done!
Recommended Posts