【文件属性】:
文件名称:groupy:分类和分组记录
文件大小:9KB
文件格式:ZIP
更新时间:2021-04-30 05:53:27
Ruby
团购
将记录分类为嵌套的值组。
例子
定义我们的组
class Food
property :dish , String
include Groupy
groupy :dish do
group :healthy do
group :fruit do
value :apple
value :orange
end
value :rice
end
group :unhealthy do
value :fried_egg
value :bacon
end
end
end
然后,我们可以要求特定的食物:
apple . healthy?
apple . fruit?
apple . apple?
我们可以按这些组中的任何一个来划分班级
Food . a
【文件预览】:
groupy-master
----.travis.yml(439B)
----Rakefile(3KB)
----test()
--------test_helper.rb(142B)
--------with_database_test.rb(1KB)
--------groupy_test.rb(3KB)
----gemfiles()
--------Gemfile.rails-4.0(110B)
--------Gemfile.rails-3.0(110B)
--------Gemfile.rails-5.0(110B)
----.rubocop.yml(419B)
----groupy.gemspec(2KB)
----Gemfile(70B)
----.gitignore(19B)
----lib()
--------groupy.rb(3KB)
----README.md(2KB)
----MIT-LICENSE(1KB)