Class: TurboBoost::Streams::StringWrapper

Inherits:
Object
  • Object
show all
Includes:
TagHelper
Defined in:
lib/turbo_boost/streams/string_wrapper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from TagHelper

#turbo_stream_invoke_tag

Constructor Details

#initialize(turbo_stream_string, turbo_stream_strings: Set.new) ⇒ StringWrapper

Returns a new instance of StringWrapper.



9
10
11
12
13
# File 'lib/turbo_boost/streams/string_wrapper.rb', line 9

def initialize(turbo_stream_string, turbo_stream_strings: Set.new)
  @turbo_stream_string = turbo_stream_string
  @turbo_stream_strings = turbo_stream_strings
  @turbo_stream_strings << turbo_stream_string
end

Instance Attribute Details

#turbo_stream_stringObject (readonly)

Returns the value of attribute turbo_stream_string.



5
6
7
# File 'lib/turbo_boost/streams/string_wrapper.rb', line 5

def turbo_stream_string
  @turbo_stream_string
end

Instance Method Details

#invokeObject



15
16
17
# File 'lib/turbo_boost/streams/string_wrapper.rb', line 15

def invoke(...)
  TurboBoost::Streams::StringWrapper.new turbo_stream_invoke_tag(...), turbo_stream_strings: turbo_stream_strings
end

#to_sObject



19
20
21
# File 'lib/turbo_boost/streams/string_wrapper.rb', line 19

def to_s
  turbo_stream_strings.to_a.join("\n").html_safe
end