class ClassHDL::BlockIF
Attributes
belong_to_module[R]
cond[RW]
opertor_chains[RW]
slaver[RW]
Public Class Methods
new(belong_to_module)
click to toggle source
# File lib/tdl/class_hdl/hdl_block_ifelse.rb, line 6 def initialize(belong_to_module) @opertor_chains = [] @cond = nil @belong_to_module = belong_to_module end
Public Instance Methods
instance(as_type= :cond)
click to toggle source
# File lib/tdl/class_hdl/hdl_block_ifelse.rb, line 12 def instance(as_type= :cond) if cond.is_a? ClassHDL::OpertorChain head_str = "if(#{cond.instance(:cond, belong_to_module)})begin" else head_str = "if(#{cond.to_s})begin" end sub_str = [] opertor_chains.each do |oc| unless oc.is_a? BlockIF unless oc.slaver rel_str = ClassHDL.compact_op_ch(oc.instance(as_type, belong_to_module)) sub_str.push " #{rel_str};" end else sub_str.push( oc.instance(as_type).gsub(/^./){ |m| " #{m}"} ) end end return "#{head_str}\n#{sub_str.join("\n")}\nend" end