Class: EagleCAD::Sheet::Net
- Inherits:
-
Object
- Object
- EagleCAD::Sheet::Net
- Defined in:
- lib/eaglecad/sheet.rb
Instance Attribute Summary collapse
-
#clearance_class ⇒ Object
Returns the value of attribute clearance_class.
-
#name ⇒ Object
Returns the value of attribute name.
-
#segments ⇒ Object
readonly
Returns the value of attribute segments.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, clearance_class) ⇒ Net
constructor
A new instance of Net.
- #to_xml ⇒ Object
Constructor Details
#initialize(name, clearance_class) ⇒ Net
Returns a new instance of Net.
131 132 133 134 135 |
# File 'lib/eaglecad/sheet.rb', line 131 def initialize(name, clearance_class) @clearance_class = clearance_class @name = name @segments = [] end |
Instance Attribute Details
#clearance_class ⇒ Object
Returns the value of attribute clearance_class.
122 123 124 |
# File 'lib/eaglecad/sheet.rb', line 122 def clearance_class @clearance_class end |
#name ⇒ Object
Returns the value of attribute name.
122 123 124 |
# File 'lib/eaglecad/sheet.rb', line 122 def name @name end |
#segments ⇒ Object (readonly)
Returns the value of attribute segments.
123 124 125 |
# File 'lib/eaglecad/sheet.rb', line 123 def segments @segments end |
Class Method Details
Instance Method Details
#to_xml ⇒ Object
137 138 139 140 141 142 143 144 |
# File 'lib/eaglecad/sheet.rb', line 137 def to_xml REXML::Element.new('net').tap do |element| element.add_attribute('name', name) element.add_attribute('class', clearance_class) unless 0 == clearance_class segments.each {|segment| element.add_element segment.to_xml } end end |