class EleetScript::ESRegex
Attributes
global[W]
Public Class Methods
from_regex(regex)
click to toggle source
# File lib/lang/runtime/base_classes.rb, line 51 def from_regex(regex) ESRegex.new(regex.source, regex.options) end
new(pattern, desired_flags = nil)
click to toggle source
Calls superclass method
# File lib/lang/runtime/base_classes.rb, line 56 def initialize(pattern, desired_flags = nil) flag_num = 0 if desired_flags.is_a?(String) flag_set = desired_flags ? Set.new(desired_flags.chars) : [] @global = true if flag_set.include?('g') flag_num |= Regexp::IGNORECASE if flag_set.include?('i') flag_num |= Regexp::MULTILINE if flag_set.include?('m') else flag_num = desired_flags end super(pattern, flag_num) end
Public Instance Methods
flags()
click to toggle source
# File lib/lang/runtime/base_classes.rb, line 81 def flags @flags ||= [].tap do |flags| flags << 'm' if multiline? flags << 'i' if ignorecase? flags << 'g' if global? end.join('') end
global?()
click to toggle source
# File lib/lang/runtime/base_classes.rb, line 69 def global? @global || false end
ignorecase?()
click to toggle source
# File lib/lang/runtime/base_classes.rb, line 73 def ignorecase? options & Regexp::IGNORECASE == Regexp::IGNORECASE end
multiline?()
click to toggle source
# File lib/lang/runtime/base_classes.rb, line 77 def multiline? options & Regexp::MULTILINE == Regexp::MULTILINE end