Sha256: e59b2c5200cb1b1f7a5a320a4f57096ed88e67d22b12039be39a34c72b9d20de

Contents?: true

Size: 544 Bytes

Versions: 2

Compression:

Stored size: 544 Bytes

Contents

module CrossStub
  module Arguments #:nodoc:
    module Proc
      class << self

        RUBY_2_RUBY = Ruby2Ruby.new

        def parse(&block)
          methods = {}
          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
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cross-stub-0.2.4 lib/cross-stub/arguments/proc.rb
cross-stub-0.2.3 lib/cross-stub/arguments/proc.rb