Parent

Files

Markaby::Fragment

Every tag method in Markaby returns a Fragment. If any method gets called on the Fragment, the tag is removed from the Markaby stream and given back as a string. Usually the fragment is never used, though, and the stream stays intact.

For a more practical explanation, check out the README.

Public Class Methods

new(*args) click to toggle source
     # File lib/markaby/builder.rb, line 281
281:     def initialize(*args)
282:       @stream, @start, @length = args
283:       @transformed_stream = false
284:     end

Private Instance Methods

method_missing(*args, &block) click to toggle source
     # File lib/markaby/builder.rb, line 292
292:     def method_missing(*args, &block)
293:       transform_stream unless transformed_stream?
294:       @str.__send__(*args, &block)
295:     end
transform_stream() click to toggle source
     # File lib/markaby/builder.rb, line 297
297:     def transform_stream
298:       @transformed_stream = true
299: 
300:       # We can't do @stream.slice!(@start, @length),
301:       # as it would invalidate the @starts and @lengths of other Fragment instances.
302:       @str = @stream[@start, @length].to_s
303:       @stream[@start, @length] = [nil] * @length
304:     end
transformed_stream?() click to toggle source
     # File lib/markaby/builder.rb, line 306
306:     def transformed_stream?
307:       @transformed_stream
308:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.