Ruby
Ruby 2.7
Fedora 32, Ruby 2.7 sürümünü sağlamaktadır. Fedora, Ruby 2.6’dan bu önemli güncellemeyle üstün Ruby geliştirme platformu oldu.
Ruby 2.6’ya göre değişiklikler:
Ruby 2.7 birkaç yeni özellik ve performans iyileştirmeleri ile birlikte gelmektedir.
Performans iyileştirmeleri
-
JIT [Deneysel]
-
Fiber’s cache strategy is changed and fiber creation is speeded up.
-
Module#name
,true.to_s
,false.to_s
, andnil.to_s
now always return a frozen String. The returned String is always the same for a given object. [Experimental] -
Monitor
veMonitorMixin
performansları iyileştirildi. -
CGI.escapeHTML
performansı iyileştirildi. -
Per-call-site
method cache, which has been there since around 1.9, was improved: cache hit rate raised from 89% to 94%. -
RubyVM::InstructionSequence#to_binary
method generates compiled binary. The binary size is reduced.
Diğer önemli değişiklikler
-
Bazı standart kütüphaneler güncellendi.
-
Bundler 2.1.2
-
RubyGems 3.1.2
-
Racc 1.4.15
-
CSV 3.1.2
-
REXML 3.2.3
-
RSS 0.2.8
-
StringScanner 1.0.3
-
Orijinal sürümü olmayan diğer birkaç kütüphane de güncellendi.
-
-
Aşağıdaki kütüphaneler artık paketlenmiş gem değil. Bu özellikleri kullanmak için ilgili gemleri kurun.
-
CMath (cmath gem)
-
Scanf (scanf gem)
-
Shell (shell gem)
-
Synchronizer (sync gem)
-
ThreadsWait (thwait gem)
-
E2MM (e2mmap gem)
-
-
profile.rb
standart kütüphaneden kaldırıldı. -
Promote
stdlib
to default gems-
Aşağıdaki öntanımlı gemler rubygems.org’da yayınlandı
-
benchmark
-
cgi
-
delegate
-
getoptlong
-
net-pop
-
net-smtp
-
open3
-
pstore
-
singleton
-
-
Aşağıdaki öntanımlı gemler sadece ruby-core’da tanıtıldı, ancak henüz rubygems.org’da yayınlanmadı.
-
monitor
-
observer
-
timeout
-
tracer
-
uri
-
yaml
-
-
-
Proc.new
andproc
with no block in a method called with a block is warned now. -
lambda with no block in a method called with a block raises an exception.
-
Unicode ve Emoji sürümleri 11.0.0’dan 12.0.0’a güncellendi.
-
Update Unicode version to 12.1.0, adding support for U+32FF SQUARE ERA NAME REIWA.
-
Date.jisx0301
,Date#jisx0301
, andDate.parse
support the new Japanese era. -
Require compilers to support C99.
Ayrıntılı değişiklikler
Pattern Matching [Experimental]
Pattern matching, a widely used feature in functional programming languages, is introduced as an experimental feature. It can traverse a given object and assign it’s value if it matches a pattern.
require "json"
json = <<END
{
"name": "Alice",
"age": 30,
"children": [{ "name": "Bob", "age": 2 }]
}
END
case JSON.parse(json, symbolize_names: true)
in {name: "Alice", children: [{name: "Bob", age: age}]}
p age #=> 2
end
REPL iyileştirmesi
irb
, the bundled interactive environment (REPL; Read-Eval-Print-Loop), now supports multi-line editing. It is powered by reline
, a readline
-compatible library implemented in pure Ruby. It also provides rdoc integration. In irb
you can display the reference for a given class, module, or method.
Compaction GC
This release introduces Compaction GC which can defragment a fragmented memory space.
Some multi-threaded Ruby programs may cause memory fragmentation, leading to high memory usage and degraded speed.
The GC.compact
method is introduced for compacting the heap. This function compacts live objects in the heap so that fewer pages may be used, and the heap may be more CoW (copy-on-write) friendly.
Separation of positional and keyword arguments
Automatic conversion of keyword arguments and positional arguments is deprecated, and conversion will be removed in Ruby 3.
Değişiklikler
-
When a method call passes a Hash at the last argument, and when it passes no keywords, and when the called method accepts keywords, a warning is emitted. To continue treating the hash as keywords, add a double splat operator to avoid the warning and ensure correct behavior in Ruby 3.
def foo(key: 42); end; foo({key: 42}) # warned def foo(**kw); end; foo({key: 42}) # warned def foo(key: 42); end; foo(**{key: 42}) # OK def foo(**kw); end; foo(**{key: 42}) # OK
-
When a method call passes keywords to a method that accepts keywords, but it does not pass enough required positional arguments, the keywords are treated as a final required positional argument, and a warning is emitted. Pass the argument as a hash instead of keywords to avoid the warning and ensure correct behavior in Ruby 3.
def foo(h, **kw); end; foo(key: 42) # warned def foo(h, key: 42); end; foo(key: 42) # warned def foo(h, **kw); end; foo({key: 42}) # OK def foo(h, key: 42); end; foo({key: 42}) # OK
-
When a method accepts specific keywords but not a keyword splat, and a hash or keywords splat is passed to the method that includes both Symbol and non-Symbol keys, the hash will continue to be split, and a warning will be emitted. You will need to update the calling code to pass separate hashes to ensure correct behavior in Ruby 3.
def foo(h={}, key: 42); end; foo("key" => 43, key: 42) # warned def foo(h={}, key: 42); end; foo({"key" => 43, key: 42}) # warned def foo(h={}, key: 42); end; foo({"key" => 43}, key: 42) # OK
-
If a method does not accept keywords, and is called with keywords, the keywords are still treated as a positional hash, with no warning. This behavior will continue to work in Ruby 3.
def foo(opt={}); end; foo( key: 42 ) # OK
-
Non-symbols are allowed as keyword argument keys if the method accepts arbitrary keywords.
def foo(**kw); p kw; end; foo("str" => 1) #=> {"str"=>1}
-
**nil
is allowed in method definitions to explicitly mark that the method accepts no keywords. Calling such a method with keywords will result in anArgumentError
.def foo(h, **nil); end; foo(key: 1) # ArgumentError def foo(h, **nil); end; foo(**{key: 1}) # ArgumentError def foo(h, **nil); end; foo("str" => 1) # ArgumentError def foo(h, **nil); end; foo({key: 1}) # OK def foo(h, **nil); end; foo({"str" => 1}) # OK
-
Passing an empty keyword splat to a method that does not accept keywords no longer passes an empty hash, unless the empty hash is necessary for a required parameter, in which case a warning will be emitted. Remove the double splat to continue passing a positional hash.
h = {}; def foo(*a) a end; foo(**h) # [] h = {}; def foo(a) a end; foo(**h) # {} and warning h = {}; def foo(*a) a end; foo(h) # [{}] h = {}; def foo(a) a end; foo(h) # {}
If you want to disable the deprecation warnings, please use a command-line argument -W:no-deprecated
or add Warning[:deprecated] = false
to your code.
Bu sürüm hakkında daha ayrıntılı bilgi için proje sürüm duyurusuna bakın.
Jekyll 4.0
Jekyll statik sayfa oluşturucu ve eklentileri 4.0.0 sürümüne güncellendi. Bu sürüm, 3.8 sürümü ile karşılaştırıldığında aşağıdaki değişiklikleri içermektedir:
-
Önemli performans iyileştirmeleri
-
Temizleme ve hata düzeltmeleri
-
Önceki sürümle uyumlu olmayan diğer küçük değişiklikler
Jekyll 4.0.0 hakkında daha fazla bilgi için https://jekyllrb.com/news/2019/08/20/jekyll-4-0-0-released/ adresine bakın.
Want to help? Learn how to contribute to Fedora Docs ›