Module: DeRjs::Rewriter

Defined in:
lib/de_rjs/rewriter.rb,
lib/de_rjs/rewriter/erbify.rb

Defined Under Namespace

Classes: Erbify

Class Method Summary collapse

Class Method Details

.rewrite_rjs(source) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/de_rjs/rewriter.rb', line 6

def rewrite_rjs(source)
  buffer = Parser::Source::Buffer.new("buffer_name")
  buffer.source = source
  parser = Parser::CurrentRuby.new
  ast = parser.parse(buffer)
  rewriter = Erbify.new

  rewriter.rewrite(buffer, ast)
end