def each_value(each_bits = nil, &block)
      # Warning! This has exponential complexity (time and space)
      # 2**n to be precise, use sparingly
      
      yield 0
      count = 1
      
      if @options[:default] != 0
        yield @options[:default]
        count += 1
      end
      
      each_bits = self.bits if each_bits == nil
      
      1.upto(each_bits.length).each do |i|
        each_bits.combination(i).each do |bits_list|
          num = bits_list.reduce(0) { |m, j| m |= (1 << j) }
          yield num
          count += 1
        end
      end
      
      count
    end
def each_value(each_bits = nil, &block)
      # Warning! This has exponential complexity (time and space)
      # 2**n to be precise, use sparingly
      
      yield 0
      count = 1
      
      if @options[:default] != 0
        yield @options[:default]
        count += 1
      end
      
      each_bits = self.bits if each_bits == nil
      
      1.upto(each_bits.length).each do |i|
        each_bits.combination(i).each do |bits_list|
          num = bits_list.reduce(0) { |m, j| m |= (1 << j) }
          yield num
          count += 1
        end
      end
      
      count
    end
Iterates over the entire combination of all possible values utilizing the
 list of bits we are given.

 Warning: Because we are iteration over possible values, the total available
 values grows exponentially with the given number of bits. For example, if
 you use only 8 bits, there are 2*8 = 256 possible values, with 20 bits it
 grows to 2**20 = 1048576. At 32 bits, 2**32 = 4294967296.

 Warning 2: We're using combinations to generate each individual number, so
 there's additional overhead causing O(n * 2^(n-1)) time complexity. Carefully
 benchmark when you have large bit lists (more than 16 bits total) and
 check both timing and memory for your use case.

 @param [optional, Array<Integer>] each_bits a list of bits used to generate
   the combination list. default: the list of bits given during initialization
 @param [Proc] block a callable method to yield individual values

 @yield num will yield to the given block multiple times, each time with one
   of the integer values that are possible from the given bits list

 @example Iterate over a list of bits
   gen = BitsGenerator.new(:is_odd => 0, :amount => [1, 2, 3], :is_cool => 4)
   values = []
   gen.each_value { |val| values << val } #=> 32
   values #=> [0, 1, 2, 4, 8, 16, 3, 5, 9, 17, 6, 10, 18, 12, 20, 24, 7, 11, 19, 13, 21, 25, 14, 22, 26, 28, 15, 23, 27, 29, 30, 31]
   values2 = []
   gen.each_value([0, 5]) { |val| values2 << val } #=> 4
   values2 #=> [0, 1, 32, 33]


 @return [Integer] total number of values yielded