Tout d'abord, référez-vous au précédent "Essayer le cacao de Ruby". https://qiita.com/KoichiroEto/items/3e408e1420171f97fe61
Quand je l'exécute, je reçois un avertissement.
% 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
Si vous modifiez Fixnum et Bignum en Integer comme indiqué ci-dessous, aucun avertissement ne sera émis.
% 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
référence:
C'est un gros problème, alors tirons-le.
--Affichez https://github.com/patrickhno/cocoa/. --Fork → eto en haut à droite.
% 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
Vérifiez les 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
--Affichez https://github.com/eto/cocoa.
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
done!
Recommended Posts