case_predicates:做出更好的案例陈述

时间:2021-02-10 22:17:19
【文件属性】:
文件名称:case_predicates:做出更好的案例陈述
文件大小:13KB
文件格式:ZIP
更新时间:2021-02-10 22:17:19
Ruby CasePredicates 通过谓词方法表达案例。 安装 将此行添加到您的应用程序的Gemfile中: gem 'case_predicates' 然后执行: $ bundle install 或自己安装为: $ gem install case_predicates 用法 在您的类中包括该模块,以便为它们提供更好的case语句。 class Example include CasePredicates def initialize ( str ) @str = str end def test case @str when string? puts "success" else raise "on no" end end end example = Example . new ( "test
【文件预览】:
case_predicates-main
----.gitignore(120B)
----.rspec(53B)
----bin()
--------setup(131B)
--------console(350B)
----.travis.yml(94B)
----CODE_OF_CONDUCT.md(3KB)
----CHANGELOG.md(0B)
----LICENSE.txt(1KB)
----.github()
--------workflows()
----spec()
--------case_predicates_spec.rb(124B)
--------test_file(0B)
--------spec_helper.rb(371B)
--------case_predicates()
----README.md(2KB)
----lib()
--------case_predicates()
--------case_predicates.rb(195B)
----case_predicates.gemspec(1KB)
----Gemfile(145B)
----Rakefile(117B)
----Gemfile.lock(621B)

网友评论