Class: Ambition::SexpTranslator
- Defined in:
- lib/ambition/sexp_translator.rb
Constant Summary collapse
- @@block_cache =
{}
Class Method Summary collapse
Class Method Details
.translate(block) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/ambition/sexp_translator.rb', line 8 def self.translate(block) @@block_cache[block.to_s] ||= begin klass = Class.new { define_method(:proc_to_method, block) } body = ParseTree.translate(klass, :proc_to_method)[2][1..-1] [:proc, *body] end end |