123456789_123456789_123456789_123456789_123456789_

Module: Prism::RegularExpressionOptions

Do not use. This module is for internal use only.
Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Included In:
Defined in: lib/prism/node_ext.rb

Instance Method Summary

  • #options

    Returns a numeric value that represents the flags that were used to create the regular expression.

Instance Method Details

#options

Returns a numeric value that represents the flags that were used to create the regular expression.

[ GitHub ]

  
# File 'lib/prism/node_ext.rb', line 23

def options
  o = 0
  o |= Regexp::IGNORECASE if flags.anybits?(RegularExpressionFlags::IGNORE_CASE)
  o |= Regexp::EXTENDED if flags.anybits?(RegularExpressionFlags::EXTENDED)
  o |= Regexp::MULTILINE if flags.anybits?(RegularExpressionFlags::MULTI_LINE)
  o |= Regexp::FIXEDENCODING if flags.anybits?(RegularExpressionFlags::EUC_JP | RegularExpressionFlags::WINDOWS_31J | RegularExpressionFlags::UTF_8)
  o |= Regexp::NOENCODING if flags.anybits?(RegularExpressionFlags::ASCII_8BIT)
  o
end