def enum_parse(text, constraints={})
      if text.nil?
        raise ArgumentError.new 'Text to parse cannot be nil'
      elsif constraints[:boundary_constraints]
        if !(constraints[:boundary_constraints].is_a?(Regexp) ||
             constraints[:boundary_constraints].is_a?(String))
          raise ArgumentError.new 'boundary constraints must be a Regexp or String'
        end
      elsif constraints[:feature_constraints] && !constraints[:feature_constraints].is_a?(Hash)
        raise ArgumentError.new 'feature constraints must be a Hash'
      elsif @options[:partial] && !text.end_with?("\n")
        raise ArgumentError.new 'partial parsing requires new-line char at end of text'
      end

      @parse_tonodes.call(text, constraints)
    end
def enum_parse(text, constraints={})
      if text.nil?
        raise ArgumentError.new 'Text to parse cannot be nil'
      elsif constraints[:boundary_constraints]
        if !(constraints[:boundary_constraints].is_a?(Regexp) ||
             constraints[:boundary_constraints].is_a?(String))
          raise ArgumentError.new 'boundary constraints must be a Regexp or String'
        end
      elsif constraints[:feature_constraints] && !constraints[:feature_constraints].is_a?(Hash)
        raise ArgumentError.new 'feature constraints must be a Hash'
      elsif @options[:partial] && !text.end_with?("\n")
        raise ArgumentError.new 'partial parsing requires new-line char at end of text'
      end

      @parse_tonodes.call(text, constraints)
    end
Parses the given string `text`, returning an
 [Enumerator](http://www.ruby-doc.org/core-2.2.1/Enumerator.html) that may be
 used to iterate over the resulting {MeCabNode} objects. This is more
 efficient than parsing to a simple string, since each node's
 information will not be materialized all at once as it is with
 string output.

 MeCab nodes contain much more detailed information about
 the morpheme. Node-formatting  may also be used to customize
 the resulting node's `feature` attribute.

 Boundary constraint parsing is available by passing in the
 `boundary_constraints` key in the `options` hash. Boundary constraints
 parsing provides hints to MeCab on where the morpheme boundaries in the
 given `text` are located. `boundary_constraints` value may be either a
 `Regexp` or `String`; please see
 [String#scan](http://ruby-doc.org/core-2.2.1/String.html#method-i-scan)

 Feature constraint parsing is available by passing in the
 `feature_constraints` key in the `options` hash. Feature constraints
 parsing provides instructions to MeCab to use the feature indicated
 for any morpheme that is an exact match for the given key.
 `feature_constraints` is a hash mapping a specific morpheme (String)
 to a corresponding feature value (String).
 @param text [String] the Japanese text to parse
 @param constraints [Hash] `boundary_constraints` or `feature_constraints`
 @return [Enumerator] of MeCabNode instances
 @raise [MeCabError] if the MeCab Tagger cannot parse the given `text`
 @raise [ArgumentError] if the given string `text` argument is `nil`
 @see MeCabNode
 @see http://ruby-doc.org/core-2.2.1/Enumerator.html