class Regextest::Front::SpecialLetter::SpecialLetter
Attributes
length[R]
offset[R]
Public Class Methods
new(value)
click to toggle source
Constructor
# File lib/regextest/front/special-letter.rb, line 15 def initialize(value) TstLog("SpecialLetter: #{value}") @value = value[0] @offset = value[1] @length = value[2] @options = @@parse_options @string = nil @obj = nil end
Public Instance Methods
json()
click to toggle source
transform to json format
# File lib/regextest/front/special-letter.rb, line 54 def json @obj.get_json_regex end
set_options(options)
click to toggle source
set options
# File lib/regextest/front/special-letter.rb, line 46 def set_options(options) TstLog("SpecialLetter set_options: #{options[:reg_options].inspect}") @string = set_string(options) @obj = Regextest::Front.new(@string, options) self end
set_string(options)
click to toggle source
set string
# File lib/regextest/front/special-letter.rb, line 28 def set_string(options) reg_options = options[:reg_options] case @value when "\\R" if reg_options.is_unicode? '(?:\x0d\x0a|[\x0a-\x0c\u{85}\u{2028}\u{2029}]|\x0d(?!\x0a))' else '(?:\x0d\x0a|\x0d(?!\x0a)|[\x0a-\x0c])' end when "\\X" # Unicode mode is not implemented yet '(?m:.)' else raise "Internal error. Invalid special letter(#{value})" end end