Class: BOAST::CaseCondition
- Inherits:
-
ControlStructure
- Object
- ControlStructure
- BOAST::CaseCondition
- Defined in:
- lib/BOAST/Language/Case.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#constants ⇒ Object
readonly
Returns the value of attribute constants.
Attributes inherited from ControlStructure
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(constants = nil, &block) ⇒ CaseCondition
constructor
A new instance of CaseCondition.
- #open ⇒ Object
- #pr(*args) ⇒ Object
- #to_s ⇒ Object
Methods inherited from ControlStructure
#[], inherited, token_string_generator
Methods included from Inspectable
Methods included from PrivateStateAccessor
#address_size, #address_size=, #annotate, #annotate=, #annotate?, #annotate_indepth_list, #annotate_indepth_list=, #annotate_level, #annotate_level=, #annotate_list, #annotate_list=, #architecture, #architecture=, #array_start, #array_start=, #chain_code, #chain_code=, #chain_code?, #debug, #debug=, #debug?, #debug_source, #debug_source=, #debug_source?, #decl_module, #decl_module=, #decl_module?, #default_align, #default_align=, #default_int_signed, #default_int_signed=, #default_int_signed?, #default_int_size, #default_int_size=, #default_real_size, #default_real_size=, #disable_openmp, #disable_openmp=, #disable_openmp?, #ffi, #ffi=, #ffi?, #fortran_line_length, #fortran_line_length=, #get_address_size, #get_annotate, #get_annotate_indepth_list, #get_annotate_level, #get_annotate_list, #get_architecture, #get_array_start, #get_chain_code, #get_debug, #get_debug_source, #get_decl_module, #get_default_align, #get_default_int_signed, #get_default_int_size, #get_default_real_size, #get_disable_openmp, #get_ffi, #get_fortran_line_length, #get_indent_increment, #get_indent_level, #get_keep_temp, #get_lang, #get_model, #get_optimizer_log, #get_optimizer_log_file, #get_output, #get_replace_constants, #get_use_vla, #get_verbose, #indent_increment, #indent_increment=, #indent_level, #indent_level=, #keep_temp, #keep_temp=, #keep_temp?, #lang, #lang=, #model, #model=, #optimizer_log, #optimizer_log=, #optimizer_log?, #optimizer_log_file, #optimizer_log_file=, #output, #output=, #replace_constants, #replace_constants=, #replace_constants?, #set_address_size, #set_annotate, #set_annotate_indepth_list, #set_annotate_level, #set_annotate_list, #set_architecture, #set_array_start, #set_chain_code, #set_debug, #set_debug_source, #set_decl_module, #set_default_align, #set_default_int_signed, #set_default_int_size, #set_default_real_size, #set_disable_openmp, #set_ffi, #set_fortran_line_length, #set_indent_increment, #set_indent_level, #set_keep_temp, #set_lang, #set_model, #set_optimizer_log, #set_optimizer_log_file, #set_output, #set_replace_constants, #set_use_vla, #set_verbose, #use_vla, #use_vla=, #use_vla?, #verbose, #verbose=, #verbose?
Constructor Details
#initialize(constants = nil, &block) ⇒ CaseCondition
Returns a new instance of CaseCondition.
8 9 10 11 |
# File 'lib/BOAST/Language/Case.rb', line 8 def initialize(constants = nil, &block) @constants = constants @block = block end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
5 6 7 |
# File 'lib/BOAST/Language/Case.rb', line 5 def block @block end |
#constants ⇒ Object (readonly)
Returns the value of attribute constants.
6 7 8 |
# File 'lib/BOAST/Language/Case.rb', line 6 def constants @constants end |
Instance Method Details
#close ⇒ Object
53 54 55 56 57 58 59 60 61 62 |
# File 'lib/BOAST/Language/Case.rb', line 53 def close if @constants and break_string then s = "" s += indent s += break_string output.puts s end decrement_indent_level return self end |
#open ⇒ Object
44 45 46 47 48 49 50 51 |
# File 'lib/BOAST/Language/Case.rb', line 44 def open s = "" s += indent s += to_s output.puts s increment_indent_level return self end |
#pr(*args) ⇒ Object
64 65 66 67 68 69 70 71 72 |
# File 'lib/BOAST/Language/Case.rb', line 64 def pr(*args) args = @args if args.length == 0 and @args open if @block then @block.call(*args) close end return self end |
#to_s ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/BOAST/Language/Case.rb', line 34 def to_s s = "" if @constants then s += case_string(@constants) else s += default_string end return s end |