文件名称:restricted_struct:受限结构宝石
文件大小:10KB
文件格式:ZIP
更新时间:2024-07-16 10:13:30
Ruby
受限结构 这个 gem 允许使用 ruby 的 Struct,但会自动将所有属性隐藏为私有或受保护的,这提供了更高级别的封装。 安装 将此行添加到应用程序的 Gemfile 中: gem 'restricted_struct' 然后执行: $ bundle 或者自己安装: $ gem install restricted_struct 用法 而不是这样做: class Rectangle < Struct . new ( :x1 , :y1 , :x2 , :y2 ) protected :x1 , :x1= , :y1 , :y1= , :x2 , :x2= , :y2 , :y2= # ... end 可以这样做: class Rectangle < RestrictedStruct . new ( :protected , :x1 , :y1 ,
【文件预览】:
restricted_struct-master
----.gitignore(118B)
----.rspec(30B)
----.travis.yml(170B)
----LICENSE.txt(1KB)
----spec()
--------spec_helper.rb(4KB)
--------restricted_struct_spec.rb(2KB)
--------restricted_struct()
----README.md(2KB)
----restricted_struct.gemspec(1KB)
----lib()
--------restricted_struct()
--------restricted_struct.rb(111B)
----Gemfile(115B)
----Rakefile(29B)