Method: Cantor::AbsoluteSet.build
- Defined in:
- lib/cantor/absolute_set.rb
.build(values) ⇒ AbsoluteSet
284 285 286 287 288 289 |
# File 'lib/cantor/absolute_set.rb', line 284 def build(values) count = -1 universe = values.inject({}){|hash, v| hash.update(v => (count += 1)) } new((1 << (count + 1)) - 1, universe) end |