class EagleCAD::Part
Attributes
device[RW]
deviceset[RW]
library[RW]
name[RW]
technology[RW]
value[RW]
Public Class Methods
from_xml(element)
click to toggle source
# File lib/eaglecad/part.rb, line 7 def self.from_xml(element) Part.new(element.attributes['name'], element.attributes['library'], element.attributes['deviceset'], element.attributes['device']).tap do |part| part.technology = element.attributes['technology'] if element.attributes['technology'] part.value = element.attributes['value'] if element.attributes['value'] end end
new(name, library, deviceset, device)
click to toggle source
# File lib/eaglecad/part.rb, line 14 def initialize(name, library, deviceset, device) @name = name @library = library @deviceset = deviceset @device = device @technology = '' end
Public Instance Methods
to_xml()
click to toggle source
# File lib/eaglecad/part.rb, line 22 def to_xml REXML::Element.new('part').tap do |element| element.add_attributes({'name' => name, 'library' => library, 'deviceset' => deviceset, 'device' => device, 'technology' => technology}) element.add_attribute('value', value) if value end end