Module: Origen::OrgFile::Interceptable::ClassMethods

Defined in:
lib/origen/org_file/interceptable.rb

Instance Method Summary collapse

Instance Method Details

#new(*args, &block) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/origen/org_file/interceptable.rb', line 9

def new(*args, &block)
  o = allocate
  i = OrgFile::Interceptor.new(o)
  o.__interceptor__ = i
  i.send(:initialize, *args, &block)
  unless o.respond_to?(:global_path_to)
    puts 'When adding the OrgFile::Interceptable module to a class, the class must define an instance method called "global_path_to", like this:'
    puts
    puts '  # Must return a string that contains a global path to access the given object,'
    puts '  # here for example if the object was a pin'
    puts '  def global_path_to'
    puts '    "dut.pins(:#{id})"'
    puts '  end'
    fail "Incomplete integration of OrgFile::Interceptable in #{o.class}"
  end
  i
end