mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
b1fd3dc160
mruby-set no longer depends on mruby-metaprog by introducing the internal `_hash` method.
mruby-set 
Set class
Install by mrbgems
- add conf.gem line to
build_config.rb
MRuby::Build.new do |conf|
# ... (snip) ...
conf.gem :git => 'https://github.com/yui-knk/mruby-set.git'
end
Example
set1 = Set.new([1,2])
set2 = Set[1,2,3]
set3 = Set[4]
set1 + set3
#=> #<Set: {1, 2, 4}>
set2 - set1
#=> #<Set: {3}>
set2 & set1
#=> #<Set: {1, 2}>
set1 ^ set2
#=> #<Set: {3}>
Limitations
These methods are not implemented yet:
- freeze
- taint
- untaint
- to_set
- divide(Set#divide with 2 arity block is not implemented.)
License
Under the MIT License:
- see LICENSE file