Method: Immutable::Set#add
- Defined in:
- lib/immutable/set.rb
#add(item) ⇒ Set Also known as: <<
Return a new Set with item added. If item is already in the set, return self.
105 106 107 |
# File 'lib/immutable/set.rb', line 105 def add(item) include?(item) ? self : self.class.alloc(@trie.put(item, nil)) end |