Class: Internal::ByteDecoder::Expression::ToRegexp

Inherits:
Internal::ByteDecoder::Expression show all
Defined in:
lib/decompiler/vm/bytedecoder.rb

Instance Attribute Summary

Attributes inherited from Internal::ByteDecoder::Expression

#pc

Instance Method Summary collapse

Methods inherited from Internal::ByteDecoder::Expression

#<=>, #fmt

Constructor Details

#initialize(pc, value) ⇒ ToRegexp

Returns a new instance of ToRegexp.



409
410
411
412
# File 'lib/decompiler/vm/bytedecoder.rb', line 409

def initialize(pc, value)
  super(pc)
  @value = value
end

Instance Method Details

#precedenceObject



425
426
427
# File 'lib/decompiler/vm/bytedecoder.rb', line 425

def precedence
  return 1
end

#to_sObject



414
415
416
417
418
419
420
421
422
423
# File 'lib/decompiler/vm/bytedecoder.rb', line 414

def to_s
  case @value
  when ConcatStrings
    string = @value.to_s
    unstring = string[1..-2]
    return Regexp.compile(unstring).inspect
  else
    return Regexp.compile(@value.to_s).inspect
  end
end