class EagleCAD::Layer
Attributes
active[RW]
color[RW]
fill[RW]
name[RW]
number[RW]
visible[RW]
Public Class Methods
from_xml(element)
click to toggle source
# File lib/eaglecad/layer.rb, line 7 def self.from_xml(element) self.new(element.attributes['name'], element.attributes['number'], element.attributes['color'], element.attributes['fill']).tap do |layer| element.attributes.each do |name, value| case name when 'active' then layer.active = ('no' != value) when 'visible' then layer.visible = ('no' != value) end end end end
new(name, number, color, fill)
click to toggle source
# File lib/eaglecad/layer.rb, line 18 def initialize(name, number, color, fill) @active = true @color = color @fill = fill @name = name @number = number @visible = true end
Public Instance Methods
to_xml()
click to toggle source
@return [REXML::Element]
# File lib/eaglecad/layer.rb, line 28 def to_xml element = REXML::Element.new 'layer' element.add_attributes({'number' => number, 'name' => name, 'color' => color, 'fill' => fill, }) element.add_attribute('active', active ? 'yes' : 'no') element.add_attribute('visible', visible ? 'yes' : 'no') element end