Sha256: 7dc97b6ad004ce6a5e4707113b40aef18d4dc4eb63d6cc0737a5d8065f7045b7

Contents?: true

Size: 416 Bytes

Versions: 3

Compression:

Stored size: 416 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

3 entries across 3 versions & 1 rubygems

Version Path
phlex-0.2.2 lib/phlex/buffered.rb
phlex-0.2.1 lib/phlex/buffered.rb
phlex-0.2.0 lib/phlex/buffered.rb