unknown:Ruby 的未知数字类

时间:2021-06-05 02:16:57
【文件属性】:
文件名称:unknown:Ruby 的未知数字类
文件大小:11KB
文件格式:ZIP
更新时间:2021-06-05 02:16:57
ruby rubygem math numeric Ruby 未知 Unknown 是表示未知数字的类。 通过使用此类来表示未知值而不是 nil,可以避免在您的函数中进行 nil 检查。 安装 将此行添加到应用程序的 Gemfile 中: gem 'unknown' 然后执行: $ bundle 或者自己安装: $ gem install unknown 用法 使用未知之前 # nil checking of arguments def population(a,k,t) fail "a is missing" unless a fail "k is missing" unless k fail "t is missing" unless t a*Math.exp(-k*t) end population(20, 30, nil) #=> Exception "t is missing" # 使用未知后 requir
【文件预览】:
unknown-master
----.gitignore(87B)
----Guardfile(432B)
----.rspec(31B)
----bmi_unknown.rb(2KB)
----bin()
--------setup(115B)
--------console(332B)
----.travis.yml(50B)
----LICENSE(1KB)
----spec()
--------extensions()
--------spec_helper.rb(146B)
--------unknown_spec.rb(723B)
----README.md(2KB)
----unknown.gemspec(1KB)
----lib()
--------unknown()
--------unknown.rb(1KB)
----Gemfile(92B)
----Rakefile(148B)
----bmi.rb(2KB)

网友评论