Method: Computering::CodeParser#walk
- Defined in:
- lib/computering/code_parser.rb
#walk(sexp, last = nil) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/computering/code_parser.rb', line 14 def walk(sexp, last=nil) sexp.each do |item| if item.is_a? Array walk(item, sexp) elsif item == :command next_item = sexp[1] token, name, _ = next_item if token == :@ident && name == "spec" block_sexp = last.last.last code = Sorcerer.source(block_sexp, multiline: true, indent: true) name = sexp.last[1].last.last.last[1] @blocks[name] = code end end end end |