Class: Gdsii::SRef

Inherits:
Element
  • Object
show all
Includes:
Access::ELFlags, Access::Plex, Access::Sname, Access::StransGroup, Access::XY
Defined in:
lib/gdsii/sref.rb

Overview

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

Instance Method Summary collapse

Methods included from Access::Sname

#sname, #sname=, #sname_record

Methods included from Access::StransGroup

#strans, #strans=

Methods included from Access::Plex

#plex, #plex=, #plex_record

Methods included from Access::ELFlags

#elflags, #elflags=, #elflags_record

Methods included from Access::XY

#xy, #xy=, #xy_record

Constructor Details

#initialize(sname = nil, xy = nil) {|_self| ... } ⇒ SRef

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)

Yields:

  • (_self)

Yield Parameters:

  • _self (Gdsii::SRef)

    the object that the method was called on



52
53
54
55
56
57
58
# 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