ruby-destructor:Ruby 的析构函数

时间:2021-05-31 10:52:41
【文件属性】:
文件名称:ruby-destructor:Ruby 的析构函数
文件大小:10KB
文件格式:ZIP
更新时间:2021-05-31 10:52:41
Ruby 析构函数 这将新的回调添加到实例对象,例如 :initialize,但会产生相反的效果:finalize 安装 将此行添加到应用程序的 Gemfile 中: gem 'destructor' 然后执行: $ bundle 或者自己安装: $ gem install destructor 用法 require 'destructor' class Foo attr_reader :bar def initialize @bar = 123 end def finalize puts "Before Destroying OBJECT: #{ self . inspect } " end end
【文件预览】:
ruby-destructor-master
----destructor.gemspec(975B)
----LICENSE.txt(1KB)
----lib()
--------destructor.rb(137B)
--------destructor()
----Gemfile(95B)
----spec()
--------spec_helper.rb(86B)
--------destructor()
----Rakefile(99B)
----README.md(1KB)
----.gitignore(185B)
----destructor()
--------destructor.gemspec(861B)
--------LICENSE.txt(1KB)
--------lib()
--------Gemfile(95B)
--------Rakefile(29B)
--------README.md(568B)
--------.gitignore(185B)

网友评论