def each_word(data,&block)
      return enum_for(:each_word,data) unless block

      unless data.respond_to?(:each_byte)
        raise(ArgumentError,"the data to hexdump must define #each_byte")
      end

      if @word_size > 1
        word  = 0
        count = 0

        init_shift = if @endian == :big
                       ((@word_size - 1) * 8)
                     else
                       0
                     end
        shift = init_shift

        data.each_byte do |b|
          word |= (b << shift)

          if @endian == :big
            shift -= 8
          else
            shift += 8
          end

          count += 1

          if count >= @word_size
            yield word

            word  = 0
            count = 0
            shift = init_shift
          end
        end

        # yield the remaining word
        yield word if count > 0
      else
        data.each_byte(&block)
      end
    end
def each_word(data,&block)
      return enum_for(:each_word,data) unless block

      unless data.respond_to?(:each_byte)
        raise(ArgumentError,"the data to hexdump must define #each_byte")
      end

      if @word_size > 1
        word  = 0
        count = 0

        init_shift = if @endian == :big
                       ((@word_size - 1) * 8)
                     else
                       0
                     end
        shift = init_shift

        data.each_byte do |b|
          word |= (b << shift)

          if @endian == :big
            shift -= 8
          else
            shift += 8
          end

          count += 1

          if count >= @word_size
            yield word

            word  = 0
            count = 0
            shift = init_shift
          end
        end

        # yield the remaining word
        yield word if count > 0
      else
        data.each_byte(&block)
      end
    end
Creates a new Hexdump dumper.

 @param [Hash] options
   Additional options.

 @option options [Integer] :width (16)
   The number of bytes to dump for each line.

 @option options [Integer] :endian (:little)
   The endianness that the bytes are organized in. Supported endianness
   include `:little` and `:big`.

 @option options [Integer] :word_size (1)
   The number of bytes within a word.

 @option options [Symbol, Integer] :base (:hexadecimal)
   The base to print bytes in. Supported bases include, `:hexadecimal`,
   `:hex`, `16, `:decimal`, `:dec`, `10, `:octal`, `:oct`, `8`,
   `:binary`, `:bin` and `2`.

 @option options [Boolean] :ascii (false)
   Print ascii characters when possible.

 @raise [ArgumentError]
   The values for `:base` or `:endian` were unknown.

 @since 0.2.0


 Iterates over every word within the data.

 @param [#each_byte] data
   The data containing bytes.

 @yield [word]
   The given block will be passed each word within the data.

 @yieldparam [Integer]
   An unpacked word from the data.

 @return [Enumerator]
   If no block is given, an Enumerator will be returned.

 @raise [ArgumentError]
   The given data does not define the `#each_byte` method.

 @since 0.2.0