module Regexpert
  class Generator
    attr_accessor :regex

    def initialize(regex)
      @regex = Regexpert::Regex.new(regex)
    end

    def generate!
      expression = regex.to_s
      str   = ""

      str << regex.split.each do |el|
        expr = Regexpert::Regex.matchers.find {|exp, val| el.match(exp) } ? expr.last : el
      end

      str
    end
  end
end

module Regexpert
  class Generator
    attr_accessor :regex

    def initialize(regex)
      @regex = Regexpert::Regex.new(regex)
    end

    def generate!
      expression = regex.to_s
      str   = ""

      regex.split.each do |el|
        if expr = Regexpert::Regex.matchers.find {|exp, val| el.match(exp) }
          str << expr.last
        else
          str << el
        end
      end

      str
    end
  end
end

Revert accidental commit that broke stuff
Revert accidental commit that broke stuff

This reverts commit dd5736802eadca86537734f4f63dc17dc4e2cf95.
