Class: ClassHDL::BlocAssertIF

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

Instance Attribute Summary

Attributes inherited from BlockIF

#belong_to_module, #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



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/tdl/class_hdl/hdl_initial.rb', line 64

def instance(as_type= :cond)
    if cond.is_a? ClassHDL::OpertorChain
        head_str = "assert(#{cond.instance(:cond, belong_to_module)})else begin"
    else 
        head_str = "assert(#{cond.to_s})else 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