bottomless_hash:无底哈希Ruby宝石

时间:2021-05-03 13:58:17
【文件属性】:
文件名称:bottomless_hash:无底哈希Ruby宝石
文件大小:8KB
文件格式:ZIP
更新时间:2021-05-03 13:58:17
Ruby 无底哈希 BottomlessHash是子类或Ruby Hash,允许您盲目分配值,而不会因缺少键而引起错误。 因此,您无需检查或使用.try.try.try...即可进行链式链接和访问密钥。 params = BottomlessHash . new params [ :world ] [ :thailand ] [ :bangkok ] [ :bangna ] params => { :world => { :thailand => { :bangkok => { :bangna => { } } } } } params [ :missing ] [ :key ] => { } # no error raised 警告 如果没有值,它将返回一个空哈希,而不是nil 。 记在脑子里: BottomlessHash . new [ :missing ] [ :key ] => {
【文件预览】:
bottomless_hash-master
----.travis.yml(76B)
----bin()
--------console(340B)
--------setup(115B)
----bottomless_hash.gemspec(1KB)
----Rakefile(117B)
----Gemfile(100B)
----.rspec(31B)
----spec()
--------hash_spec.rb(582B)
--------bottomless_hash_spec.rb(1KB)
--------spec_helper.rb(85B)
----.gitignore(87B)
----lib()
--------bottomless_hash()
--------bottomless_hash.rb(263B)
----CODE_OF_CONDUCT.md(1KB)
----README.md(1KB)
----LICENSE.txt(1KB)

网友评论