Class: EagleCAD::Sheet::Bus
- Inherits:
-
Object
- Object
- EagleCAD::Sheet::Bus
- Defined in:
- lib/eaglecad/sheet.rb
Instance Attribute Summary collapse
-
#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) ⇒ Bus
constructor
A new instance of Bus.
- #to_xml ⇒ Object
Constructor Details
#initialize(name) ⇒ Bus
Returns a new instance of Bus.
31 32 33 34 |
# File 'lib/eaglecad/sheet.rb', line 31 def initialize(name) @name = name @segments = [] end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
22 23 24 |
# File 'lib/eaglecad/sheet.rb', line 22 def name @name end |
#segments ⇒ Object (readonly)
Returns the value of attribute segments.
23 24 25 |
# File 'lib/eaglecad/sheet.rb', line 23 def segments @segments end |
Class Method Details
Instance Method Details
#to_xml ⇒ Object
36 37 38 39 40 41 |
# File 'lib/eaglecad/sheet.rb', line 36 def to_xml REXML::Element.new('bus').tap do |element| element.add_attribute 'name', name segments.each {|segment| element.add_element segment.to_xml } end end |