Sha256: 3d062eef859c2faca081fe39f59cbac42d1732c788a663ab12f131732ddf5e24
Contents?: true
Size: 651 Bytes
Versions: 1
Compression:
Stored size: 651 Bytes
Contents
# frozen_string_literal: true require_relative "regexp_wrapper/version" module RegexpWrapper class QueryWrapper attr_accessor :header, :body, :footer def initialize @header = "" @body = "" @footer = "" end def start_with!(content) @header = "^#{content}" self end def end_with!(content) @footer = "#{content}\\z" self end def has!(content) @body = @body + ".*#{content}" self end def to_regexp express = @header + @body + ".*" + @footer Regexp.new(express) end def =~(content) content.to_s =~ to_regexp end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
regexp_wrapper-0.1.0 | lib/regexp_wrapper.rb |