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.



755
756
757
# File 'lib/BOAST/Algorithm.rb', line 755

def initialize(&block)
  @block = block
end

Instance Method Details



759
760
761
762
763
764
765
766
767
768
769
# File 'lib/BOAST/Algorithm.rb', line 759

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