Class: ClassHDL::BlockELSE

Inherits:
BlockIF
  • Object
show all
Defined in:
lib/tdl/class_hdl/hdl_block_ifelse.rb

Direct Known Subclasses

BlockFOR, BlockFOREACH

Instance Attribute Summary

Attributes inherited from BlockIF

#cond, #opertor_chains, #slaver

Instance Method Summary collapse

Methods inherited from BlockIF

#initialize

Constructor Details

This class inherits a constructor from ClassHDL::BlockIF

Instance Method Details

#instance(as_type = :cond) ⇒ Object



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/tdl/class_hdl/hdl_block_ifelse.rb', line 59

def instance(as_type= :cond)
   
    head_str = "else begin"

    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")}\nend"

end