Class: EagleCAD::DeviceSet::Gate

Inherits:
Struct
  • Object
show all
Defined in:
lib/eaglecad/deviceset.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#addlevelObject

Returns the value of attribute addlevel

Returns:

  • (Object)

    the current value of addlevel



61
62
63
# File 'lib/eaglecad/deviceset.rb', line 61

def addlevel
  @addlevel
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



61
62
63
# File 'lib/eaglecad/deviceset.rb', line 61

def name
  @name
end

#originObject

Returns the value of attribute origin

Returns:

  • (Object)

    the current value of origin



61
62
63
# File 'lib/eaglecad/deviceset.rb', line 61

def origin
  @origin
end

#swaplevelObject

Returns the value of attribute swaplevel

Returns:

  • (Object)

    the current value of swaplevel



61
62
63
# File 'lib/eaglecad/deviceset.rb', line 61

def swaplevel
  @swaplevel
end

#symbolObject

Returns the value of attribute symbol

Returns:

  • (Object)

    the current value of symbol



61
62
63
# File 'lib/eaglecad/deviceset.rb', line 61

def symbol
  @symbol
end

Class Method Details

.from_xml(element) ⇒ Object



62
63
64
# File 'lib/eaglecad/deviceset.rb', line 62

def self.from_xml(element)
		Gate.new element.attributes['name'], element.attributes['symbol'], Geometry.point_from(element, 'x', 'y'), element.attributes['addlevel'], element.attributes['swaplevel']
end

Instance Method Details

#to_xmlREXML::Element

Returns:

  • (REXML::Element)


67
68
69
# File 'lib/eaglecad/deviceset.rb', line 67

def to_xml
		REXML::Element.new('gate').tap {|element| element.add_attributes({'name' => name, 'symbol' => symbol, 'x' => origin.x, 'y' => origin.y, 'addlevel' => addlevel, 'swaplevel' => swaplevel}) }
end