Class: Gerber
- Inherits:
-
Object
- Object
- Gerber
- Defined in:
- lib/gerber.rb,
lib/gerber/layer.rb,
lib/gerber/parser.rb,
lib/gerber/aperture.rb,
lib/gerber/layer/parser.rb
Overview
An Aperture definition for an Extended Gerber file
Defined Under Namespace
Classes: Aperture, Layer, Parser
Constant Summary collapse
- ParseError =
Class.new(StandardError)
- Arc =
Geometry::Arc
- Line =
Geometry::Line
- Point =
Geometry::Point
Instance Attribute Summary collapse
-
#apertures ⇒ Object
readonly
Returns the value of attribute apertures.
-
#decimal_places ⇒ Object
Returns the value of attribute decimal_places.
-
#integer_places ⇒ Object
Returns the value of attribute integer_places.
-
#layers ⇒ Object
readonly
Returns the value of attribute layers.
-
#zero_omission ⇒ Object
Returns the value of attribute zero_omission.
Class Method Summary collapse
-
.read(filename) ⇒ Gerber
Read and parse the given file into a Gerber object.
- .write(filename, container) ⇒ Object
Instance Method Summary collapse
-
#coordinate_format=(*args) ⇒ Object
Set the format used for coordinates.
-
#initialize ⇒ Gerber
constructor
A new instance of Gerber.
Constructor Details
#initialize ⇒ Gerber
Returns a new instance of Gerber.
20 21 22 23 24 25 |
# File 'lib/gerber.rb', line 20 def initialize @apertures = [] @layers = [] @polarity = :positive @units = nil end |
Instance Attribute Details
#apertures ⇒ Object (readonly)
Returns the value of attribute apertures.
18 19 20 |
# File 'lib/gerber.rb', line 18 def apertures @apertures end |
#decimal_places ⇒ Object
Returns the value of attribute decimal_places.
15 16 17 |
# File 'lib/gerber.rb', line 15 def decimal_places @decimal_places end |
#integer_places ⇒ Object
Returns the value of attribute integer_places.
15 16 17 |
# File 'lib/gerber.rb', line 15 def integer_places @integer_places end |
#layers ⇒ Object (readonly)
Returns the value of attribute layers.
18 19 20 |
# File 'lib/gerber.rb', line 18 def layers @layers end |
#zero_omission ⇒ Object
Returns the value of attribute zero_omission.
16 17 18 |
# File 'lib/gerber.rb', line 16 def zero_omission @zero_omission end |
Class Method Details
.read(filename) ⇒ Gerber
Read and parse the given file into a Gerber object
36 37 38 39 40 |
# File 'lib/gerber.rb', line 36 def self.read(filename) File.open(filename) do |f| Gerber::Parser.new.parse(f) end end |
.write(filename, container) ⇒ Object
42 43 |
# File 'lib/gerber.rb', line 42 def self.write(filename, container) end |
Instance Method Details
#coordinate_format=(*args) ⇒ Object
Set the format used for coordinates
30 31 32 |
# File 'lib/gerber.rb', line 30 def coordinate_format=(*args) self.integer_places, self.decimal_places = args.flatten.map {|a| a.to_i } end |