Class: ClassHDL::BlockELSIF
- Defined in:
- lib/tdl/class_hdl/hdl_block_ifelse.rb
Instance Attribute Summary
Attributes inherited from BlockIF
#belong_to_module, #cond, #opertor_chains, #slaver
Instance Method Summary collapse
Methods inherited from BlockIF
Constructor Details
This class inherits a constructor from ClassHDL::BlockIF
Instance Method Details
#instance(as_type = :cond) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/tdl/class_hdl/hdl_block_ifelse.rb', line 37 def instance(as_type= :cond) if cond.is_a? ClassHDL::OpertorChain head_str = "else if(#{cond.instance(:cond, belong_to_module)})begin" else head_str = "else if(#{cond.to_s})begin" end sub_str = [] opertor_chains.each do |oc| unless oc.is_a? BlockIF unless oc.slaver sub_str.push " #{oc.instance(as_type, belong_to_module)};" end else sub_str.push( oc.instance(as_type).gsub(/^./){ |m| " #{m}"} ) end end return "#{head_str}\n#{sub_str.join("\n")}\nend" end |