Class: Zubat::RubyCode
- Inherits:
-
Object
- Object
- Zubat::RubyCode
- Defined in:
- lib/zubat/ruby_code.rb
Instance Method Summary collapse
-
#initialize(code:) ⇒ RubyCode
constructor
A new instance of RubyCode.
- #valid? ⇒ Boolean
Constructor Details
#initialize(code:) ⇒ RubyCode
Returns a new instance of RubyCode.
5 6 7 |
# File 'lib/zubat/ruby_code.rb', line 5 def initialize(code:) @code = code end |
Instance Method Details
#valid? ⇒ Boolean
9 10 11 12 13 14 15 |
# File 'lib/zubat/ruby_code.rb', line 9 def valid? RubyVM::InstructionSequence.compile(@code) true rescue SyntaxError false end |