class FN::SWF::Struct

Constants

TAB

Attributes

buffer[R]

Public Class Methods

new() click to toggle source
# File lib/fn/swf/struct.rb, line 8
def initialize
  @buffer = ""
  @indent_level = 0
end

Public Instance Methods

<<(s, omit_end_tag = false, &b) click to toggle source
# File lib/fn/swf/struct.rb, line 17
def <<(s, omit_end_tag = false, &b)
  @buffer << "#{tabs}#{s}\n"
  if block_given?
    indent(&b)
    @buffer << "#{tabs}.end\n"      unless omit_end_tag
  end
end
break() click to toggle source
# File lib/fn/swf/struct.rb, line 13
def break
  self << ""
end
indent() { || ... } click to toggle source
# File lib/fn/swf/struct.rb, line 29
def indent
  @indent_level += 1
  if block_given?
    yield
    @indent_level -= 1
  end
end
tabs() click to toggle source
# File lib/fn/swf/struct.rb, line 25
def tabs
  TAB * @indent_level
end
undent() click to toggle source
# File lib/fn/swf/struct.rb, line 37
def undent
  @indent_level -= 1
  raise "can't indent < 0"          if @indent_level < 0
end