Class: EagleCAD::Board::Signal
- Inherits:
-
Object
- Object
- EagleCAD::Board::Signal
- Defined in:
- lib/eaglecad/board.rb
Instance Attribute Summary collapse
-
#air_wires_hidden ⇒ Object
Returns the value of attribute air_wires_hidden.
-
#clearance_class ⇒ Object
Returns the value of attribute clearance_class.
-
#contact_references ⇒ Object
readonly
Returns the value of attribute contact_references.
-
#name ⇒ Object
Returns the value of attribute name.
-
#vias ⇒ Object
readonly
Returns the value of attribute vias.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name) ⇒ Signal
constructor
A new instance of Signal.
Constructor Details
#initialize(name) ⇒ Signal
Returns a new instance of Signal.
96 97 98 99 100 |
# File 'lib/eaglecad/board.rb', line 96 def initialize(name) @contact_references = [] @name = name @vias = [] end |
Instance Attribute Details
#air_wires_hidden ⇒ Object
Returns the value of attribute air_wires_hidden.
66 67 68 |
# File 'lib/eaglecad/board.rb', line 66 def air_wires_hidden @air_wires_hidden end |
#clearance_class ⇒ Object
Returns the value of attribute clearance_class.
66 67 68 |
# File 'lib/eaglecad/board.rb', line 66 def clearance_class @clearance_class end |
#contact_references ⇒ Object (readonly)
Returns the value of attribute contact_references.
67 68 69 |
# File 'lib/eaglecad/board.rb', line 67 def contact_references @contact_references end |
#name ⇒ Object
Returns the value of attribute name.
66 67 68 |
# File 'lib/eaglecad/board.rb', line 66 def name @name end |
#vias ⇒ Object (readonly)
Returns the value of attribute vias.
67 68 69 |
# File 'lib/eaglecad/board.rb', line 67 def vias @vias end |
Class Method Details
.from_xml(element) ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/eaglecad/board.rb', line 69 def self.from_xml(element) self.new(element.attributes['name']).tap do |signal| element.attributes.each do |name, value| case name when 'airwireshidden' signal.air_wires_hidden = ('no' != value) when 'class' signal.clearance_class = value.to_i when 'name' # Ignore; already handled else raise StandardError, "Unrecognized Signal element '#{element.name}'" end end element.elements.each do |element| case element.name when 'contactref' signal.contact_references.push ContactReference.new element.attributes['element'], element.attributes['pad'], element.attributes['route'], element.attributes['routetag'] when 'polygon', 'wire' signal.push Geometry.from_xml(element) when 'via' signal.vias.push Via.new Geometry.from_point(element), element.attributes['extent'], element.attributes['drill'] end end end end |