Class: Phlex::SGML::State
- Inherits:
-
Object
- Object
- Phlex::SGML::State
- Defined in:
- lib/phlex/opal_compat.rb
Instance Method Summary collapse
- #capture ⇒ Object
-
#initialize(user_context: {}, output_buffer:, fragments:) ⇒ State
constructor
A new instance of State.
Constructor Details
#initialize(user_context: {}, output_buffer:, fragments:) ⇒ State
Returns a new instance of State.
283 284 285 286 287 288 289 290 291 292 |
# File 'lib/phlex/opal_compat.rb', line 283 def initialize(user_context: {}, output_buffer:, fragments:) @buffer = Phlex::OpalBuffer.new @capturing = false @user_context = user_context @fragments = fragments @fragment_depth = 0 @cache_stack = [] @halt_signal = nil @output_buffer = output_buffer end |
Instance Method Details
#capture ⇒ Object
294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 |
# File 'lib/phlex/opal_compat.rb', line 294 def capture new_buffer = Phlex::OpalBuffer.new original_buffer = @buffer original_capturing = @capturing original_fragments = @fragments begin @buffer = new_buffer @capturing = true @fragments = nil yield ensure @buffer = original_buffer @capturing = original_capturing @fragments = original_fragments end new_buffer end |