Module: HDLRuby::High::Hmissing

Included in:
HScope_missing, Std::ChannelB, Std::ChannelI, Std::ReconfI, Std::TaskI, SystemT
Defined in:
lib/HDLRuby/hruby_high.rb

Overview

Module providing handling of unknown methods for hardware constructs.

Constant Summary collapse

High =
HDLRuby::High

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args, &ruby_block) ⇒ Object

Missing methods may be immediate values, if not, they are looked up in the upper level of the namespace if any.



138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# File 'lib/HDLRuby/hruby_high.rb', line 138

def method_missing(m, *args, &ruby_block)
    # puts "method_missing in class=#{self.class} with m=#{m}"
    # Is the missing method an immediate value?
    value = m.to_value
    return value if value and args.empty?
    # No, is there an upper namespace, i.e. is the current object
    # present in the space?
    if High.space_index(self) then
        # Yes, self is in it, can try the methods in the space.
        High.space_call(m,*args,&ruby_block)
    elsif self.respond_to?(:namespace) and
          High.space_index(self.namespace) then
        # Yes, the private namespace is in it, can try the methods in
        # the space.
        begin
            High.space_call(m,*args,&ruby_block)
        end
    elsif self.respond_to?(:public_namespace) and
          High.space_index(self.public_namespace) then
        # Yes, the private namespace is in it, can try the methods in
        # the space.
        High.space_call(m,*args,&ruby_block)
    else
        # No, this is a true error.
        raise NotDefinedError, "undefined HDLRuby construct, local variable or method `#{m}'."
    end
end