Sha256: c1f25bbca9d259216a7c8180af6b6baf29dbc2f9c0b18f9d3dbcdb2f6f46fa7c

Contents?: true

Size: 387 Bytes

Versions: 4

Compression:

Stored size: 387 Bytes

Contents

# frozen_string_literal: true

module Phlex
	class Buffered
		def initialize(object, buffer:)
			@object, @buffer = object, buffer
		end

		def method_missing(name, *args, **kwargs, &block)
			output = @object.public_send(name, *args, **kwargs, &block)
			@buffer << output if output.is_a? String
			nil
		end

		def respond_to_missing?(name)
			@object.respond_to?(name)
		end
	end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
phlex-0.4.0 lib/phlex/buffered.rb
phlex-0.3.2 lib/phlex/buffered.rb
phlex-0.3.1 lib/phlex/buffered.rb
phlex-0.3.0 lib/phlex/buffered.rb