Class: XMP2Assert::Converter

Inherits:
Object
  • Object
show all
Defined in:
lib/xmp2assert/converter.rb

Overview

This class converts a Ruby script into assertions

Class Method Summary collapse

Class Method Details

.convert(obj, file = nil, line = nil) ⇒ (Quasifile,String)

Detects XMP and make them assertions. For example:

def foo; 2; end
1 + foo # => 3

would become

def foo; 2; end
(1 + foo).tap {|i| assert_xmp("3", i ) }

Returns:

  • ((Quasifile,String))

    tuple of generated file and its expected output.



53
54
55
56
# File 'lib/xmp2assert/converter.rb', line 53

def self.convert obj, file = nil, line = nil
  this = new obj, file, line
  return this.send :convert
end