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.54.4 lib/origen/core_ext/regexp.rb
origen-0.54.3 lib/origen/core_ext/regexp.rb
origen-0.54.2 lib/origen/core_ext/regexp.rb
origen-0.54.1 lib/origen/core_ext/regexp.rb
origen-0.54.0 lib/origen/core_ext/regexp.rb
origen-0.53.1 lib/origen/core_ext/regexp.rb
origen-0.53.0 lib/origen/core_ext/regexp.rb
origen-0.52.4 lib/origen/core_ext/regexp.rb
origen-0.52.3 lib/origen/core_ext/regexp.rb
origen-0.52.2 lib/origen/core_ext/regexp.rb
origen-0.52.1 lib/origen/core_ext/regexp.rb
origen-0.52.0 lib/origen/core_ext/regexp.rb
origen-0.51.3 lib/origen/core_ext/regexp.rb
origen-0.51.2 lib/origen/core_ext/regexp.rb
origen-0.51.1 lib/origen/core_ext/regexp.rb
origen-0.51.0 lib/origen/core_ext/regexp.rb
origen-0.50.0 lib/origen/core_ext/regexp.rb
origen-0.44.0 lib/origen/core_ext/regexp.rb
origen-0.43.0 lib/origen/core_ext/regexp.rb
origen-0.42.2 lib/origen/core_ext/regexp.rb