class Gdsii::SRef

Represents a GDSII structure reference (SRef) element. Most methods are from Element or from the various included Access module methods.

Public Class Methods

new(sname=nil, xy=nil) { |self| ... } click to toggle source

Create a structure reference (SREF) within a Structure object (also known as a structure “instantiation”).

struct1 = Gdsii::Structure.new('top')
struct2 = Gdsii::Structure.new('sub')
struct1.add SRef.new('sub')

Alternatively, any object with a to_s method can be passed and the to_s method will be used to coerce the object into a string. For example, a structure object itself can be used (instead of the structure name) through Structure#to_s:

struct1.add SRef.new(struct2)
Calls superclass method Gdsii::Element.new
# File lib/gdsii/sref.rb, line 52
def initialize(sname=nil, xy=nil)
  super()
  @records[GRT_SREF] = Record.new(GRT_SREF)
  self.sname = sname.to_s unless sname.nil?
  self.xy = xy unless xy.nil?
  yield self if block_given?
end