Class: BOAST::CodeBlock

Inherits:
Object show all
Defined in:
lib/BOAST/Algorithm.rb

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ CodeBlock

Returns a new instance of CodeBlock.



855
856
857
# File 'lib/BOAST/Algorithm.rb', line 855

def initialize(&block)
  @block = block
end

Instance Method Details



859
860
861
862
863
864
865
866
867
868
869
# File 'lib/BOAST/Algorithm.rb', line 859

def print(final=true)
  s=""
  s += " "*BOAST::get_indent_level if final
  BOAST::increment_indent_level
  BOAST::get_output.puts s if final
  if @block then
    s += "\n"
    @block.call
  end
  return s
end