File: output_wrapper.rb

package info (click to toggle)
ruby-rspec 3.13.0c0e0m0s1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,856 kB
  • sloc: ruby: 70,868; sh: 1,423; makefile: 99
file content (29 lines) | stat: -rw-r--r-- 622 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
module RSpec
  module Core
    # @private
    class OutputWrapper
      # @private
      attr_accessor :output

      # @private
      def initialize(output)
        @output = output
      end

      def respond_to?(name, priv=false)
        output.respond_to?(name, priv)
      end

      def method_missing(name, *args, &block)
        output.__send__(name, *args, &block)
      end

      # Redirect calls for IO interface methods
      IO.instance_methods(false).each do |method|
        define_method(method) do |*args, &block|
          output.__send__(method, *args, &block)
        end
      end
    end
  end
end