Class: ClassHDL::BlockCASE
- 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
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/tdl/class_hdl/hdl_block_ifelse.rb', line 82 def instance(as_type= :cond) if cond.is_a? ClassHDL::OpertorChain head_str = "case(#{cond.instance(:cond)}) " else head_str = "case(#{cond.to_s}) " end sub_str = [] opertor_chains.each do |oc| unless oc.is_a? BlockIF unless oc.slaver sub_str.push " #{oc.instance(as_type)};" end else sub_str.push( oc.instance(as_type).gsub(/^./){ |m| " #{m}"} ) end end return "#{head_str}\n#{sub_str.join("\n")}\nendcase" end |