Class: TypeProf::Utils::MutableSet
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Instance Chain:
self,
Enumerable
|
|
Inherits: | Object |
Defined in: | lib/typeprof/utils.rb |
Class Method Summary
- .new(*values) ⇒ MutableSet constructor
Instance Method Summary
Constructor Details
.new(*values) ⇒ MutableSet
# File 'lib/typeprof/utils.rb', line 95
def initialize(*values) @hash = {} values.each {|v| @hash[v] = v } end
Instance Method Details
#<<(v)
[ GitHub ]# File 'lib/typeprof/utils.rb', line 106
def <<(v) @hash[v] = true end
#[](v)
[ GitHub ]# File 'lib/typeprof/utils.rb', line 110
def [](v) @hash[v] end
#delete(v)
[ GitHub ]# File 'lib/typeprof/utils.rb', line 114
def delete(v) @hash.delete(v) end
#each(&blk)
[ GitHub ]# File 'lib/typeprof/utils.rb', line 100
def each(&blk) @hash.each_key(&blk) end
#inspect
[ GitHub ]# File 'lib/typeprof/utils.rb', line 118
def inspect s = [] each {|v| s << v.inspect } "{#{ s.join(", ") }}" end
#size
[ GitHub ]# File 'lib/typeprof/utils.rb', line 124
def size @hash.size end
#to_set
[ GitHub ]# File 'lib/typeprof/utils.rb', line 128
def to_set Set[*@hash.keys] end