lib/cross-stub/arguments/proc.rb in cross-stub-0.2.2 vs lib/cross-stub/arguments/proc.rb in cross-stub-0.2.3

- old
+ new

@@ -5,13 +5,19 @@ RUBY_2_RUBY = Ruby2Ruby.new def parse(&block) methods = {} - block.to_sexp.each_of_type(:defn) do |_sexp| + proc_to_sexp(block).each_of_type(:defn) do |_sexp| methods[_sexp.to_a[1]] = RUBY_2_RUBY.process(_sexp) end methods + end + + def proc_to_sexp(block) + block.to_sexp(:stip_enclosure => true, :attached_to => :xstub) do |body| + body =~ /^(.*\W|)def\W/ + end end end end end