Sha256: feb8a2ed09150d66b3df834a0bbe9b314664c3ce68ffefd5ca5dfaa2fa98faa3

Contents?: true

Size: 594 Bytes

Versions: 4

Compression:

Stored size: 594 Bytes

Contents

module Putter
  module MethodCreator
    def add_putter_method_to_proxy(proxy, data)
      proxy.send(:instance_exec, data) do |data|
        define_method(data.method) do |*proxy_args, &blk|
          data.line = caller.find {|call| call.match(data.stack_trace_ignore_regex)}
          if data.line.include?(::Dir.pwd)
            data.line = data.line.split(::Dir.pwd)[1]
          end
          data.args = proxy_args.to_s
          data.result = super *proxy_args, &blk
          ::Putter.configuration.print_strategy.call data
          data.result
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
putter-0.7.0 lib/putter/method_creator.rb
putter-0.6.1 lib/putter/method_creator.rb
putter-0.6.0 lib/putter/method_creator.rb
putter-0.5.1 lib/putter/method_creator.rb