用法
clear()
删除所有元素并返回 self。
set = Set[1, 'c', :s] #=> #<Set: {1, "c", :s}>
set.clear #=> #<Set: {}>
set #=> #<Set: {}>
相关用法
- Ruby Set.classify用法及代码示例
- Ruby Set.replace用法及代码示例
- Ruby Set.==用法及代码示例
- Ruby Set.disjoint?用法及代码示例
- Ruby Set.[]用法及代码示例
- Ruby Set.===用法及代码示例
- Ruby Set.-用法及代码示例
- Ruby Set.&用法及代码示例
- Ruby Set.to_a用法及代码示例
- Ruby Set.|用法及代码示例
- Ruby Set.^用法及代码示例
- Ruby Set.add用法及代码示例
- Ruby Set.new用法及代码示例
- Ruby Set.intersect?用法及代码示例
- Ruby Set.divide用法及代码示例
- Ruby Set.add?用法及代码示例
- Ruby Set flatten()用法及代码示例
- Ruby Set intersection()用法及代码示例
- Ruby Set类用法及代码示例
- Ruby Set size()用法及代码示例
- Ruby Set compare_by_identity?用法及代码示例
- Ruby Set add?用法及代码示例
- Ruby Set compare_by_identity()用法及代码示例
- Ruby Set divide()用法及代码示例
- Ruby Set replace()用法及代码示例
注:本文由堆栈答案筛选整理自ruby-lang.org大神的英文原创作品 Set.clear。非经特殊声明,原始代码版权归原作者所有,本译文的传播和使用请遵循“署名-相同方式共享 4.0 国际 (CC BY-SA 4.0)”协议。