class BOAST::While
Constants
- ANNOTATIONS
Attributes
condition[R]
Public Class Methods
new(condition, &block)
click to toggle source
Creates a new instance of the While
construct. @param [Expression] condition @param [Proc,nil] block if given, will be evaluated when {pr} is called
Calls superclass method
BOAST::ControlStructure::new
# File lib/BOAST/Language/While.rb, line 13 def initialize(condition, &block) super() @condition = condition @block = block end
Public Instance Methods
close()
click to toggle source
open()
click to toggle source
pr(*args, &block)
click to toggle source
Prints the While
construct to the BOAST
output (see {open}). If
a block is provided during initialization, it will be printed and the construct will be closed (see {close}). @param [Array<Object>] args any number of arguments to pass to the block @param [Proc] block an optional block to be evaluated. Supersede the one given at initialization @return [self]
# File lib/BOAST/Language/While.rb, line 58 def pr(*args, &block) args = @args if args.length == 0 and @args block = @block unless block open if block then block.call(*args) close end return self end
to_s()
click to toggle source
Returns a string representation of the While
construct.
# File lib/BOAST/Language/While.rb, line 38 def to_s return while_string(@condition) end
Private Instance Methods
get_c_strings()
click to toggle source
# File lib/BOAST/Language/While.rb, line 19 def get_c_strings return { :while => '"while (#{cond}) {"', :end => '"}"' } end
Also aliased as: get_cl_strings, get_cuda_strings
get_fortran_strings()
click to toggle source
# File lib/BOAST/Language/While.rb, line 24 def get_fortran_strings return { :while => '"do while (#{cond})"', :end => '"end do"' } end