Sha256: 4a8076de5adeb2509d279e87e3de2600ecf67da86228923ca9c0afe3d58af10e

Contents?: true

Size: 843 Bytes

Versions: 3

Compression:

Stored size: 843 Bytes

Contents

# frozen_string_literal: true

# @api private
class Phlex::Rails::Unbuffered
	def initialize(component)
		@component = component
	end

	def respond_to_missing?(...)
		@component.respond_to?(...)
	end

	def method_missing(method_name, *, **, &erb)
		if @component.respond_to?(method_name)
			output = @component.capture do
				if erb
					@component.public_send(method_name, *, **) do |*a, **kw|
						@component.raw(
							@component.helpers.capture(
								*a,
								**kw,
								&erb
							),
						)
					end
				else # no erb block
					@component.public_send(method_name, *, **)
				end
			end
		else
			super
		end
	end

	def inspect
		"Unbuffered(#{@component.inspect})"
	end

	def call(...)
		@component.call(...)
	end

	def send(...)
		@component.__send__(...)
	end

	def public_send(...)
		@component.public_send(...)
	end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
phlex-rails-2.0.0.rc1 lib/phlex/rails/unbuffered.rb
phlex-rails-2.0.0.beta2 lib/phlex/rails/unbuffered.rb
phlex-rails-2.0.0.beta1 lib/phlex/rails/unbuffered.rb