Sha256: 79674e1b62109aae5e86191626ad964db695195f40a49c6e1f70c251d998a162
Contents?: true
Size: 803 Bytes
Versions: 2
Compression:
Stored size: 803 Bytes
Contents
require 'parse_tree' require 'ruby2ruby' module VirtualKeywords # Class that turns a sexp back into a string of Ruby code. class SexpStringifier # Initialize the SexpStringifier # # Arguments: # unifier: (Unifier) a Unifier, used by ParseTree/ruby2ruby (optional) # ruby2ruby: (Ruby2Ruby) a Ruby2Ruby, used by ParseTree/ruby2ruby # (optional) def initialize(unifier = Unifier.new, ruby2ruby = Ruby2Ruby.new) @unifier = unifier @ruby2ruby = ruby2ruby end # Turn a sexp into a string of Ruby code. # # Arguments: # sexp: (Sexp) the sexp to be stringified. # # Returns: # (String) Ruby code equivalent to the sexp. def stringify(sexp) @ruby2ruby.process(@unifier.process(sexp)) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
virtual_keywords-0.1.0 | lib/virtual_keywords/sexp_stringifier.rb |
virtual_keywords-0.0.0 | lib/virtual_keywords/sexp_stringifier.rb |