Sha256: 56e72fc2f371b98b9ba1db60492b06dd59b0f0d3896bde10fd2835419e0bd980

Contents?: true

Size: 492 Bytes

Versions: 103

Compression:

Stored size: 492 Bytes

Contents

require 'yaml'
class Regexp
  def to_txt(options = {})
    options = {
      no_mods: false
    }.update(options)
    expr, mods = '', ''
    if to_yaml.match(/regexp\s+\/(.*)\/(.*)/).nil?
      Origen.log.error('Cannot convert the regular expression to text, something changed in the YAML view of the regular expressions')
      fail
    else
      (expr, mods) = to_yaml.match(/regexp\s+\/(.*)\/(.*)/).captures
    end
    options[:no_mods] ? "\/#{expr}\/" : "\/#{expr}\/#{mods}"
  end
end

Version data entries

103 entries across 103 versions & 1 rubygems

Version Path
origen-0.20.1 lib/origen/core_ext/regexp.rb
origen-0.20.0 lib/origen/core_ext/regexp.rb
origen-0.13.0 lib/origen/core_ext/regexp.rb