Class: Gcodify::Op

Inherits:
Object
  • Object
show all
Defined in:
lib/gcodify/op.rb

Overview

An Operation. An Operation is the unit of “doing”. For instance, a drilled hole is a single Op, a circular pocket is a single Op, and so on. Ops are subclassed into things like HoleOp, PocketOp, etc., and each is responsible for storing data and each provides its own implementation of #to_gcode.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Op

Returns a new instance of Op

Parameters:

  • options (Hash)

    a Hash of options to be passed in to the op


12
13
14
# File 'lib/gcodify/op.rb', line 12

def initialize(options)
  @options = options
end

Instance Attribute Details

#optionsHash (readonly)

Returns the options passed to the Op. Used for testing.

Returns:

  • (Hash)

    the options passed to the Op. Used for testing.


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/gcodify/op.rb', line 8

class Op
  attr_reader :options

  # @param options [Hash] a {Hash} of options to be passed in to the op
  def initialize(options)
    @options = options
  end

  # Converts the {Op} to Gcode. Each *{Op} has it's own implementation of #to_gcode,
  # depending on what gcode it has to generate.
  #
  # @return [String] some gcode
  def to_gcode
    "" # Return an empty string for testing purposes.
  end
end

Instance Method Details

#to_gcodeString

Converts the Gcodify::Op to Gcode. Each *Gcodify::Op has it's own implementation of #to_gcode, depending on what gcode it has to generate.

Returns:

  • (String)

    some gcode


20
21
22
# File 'lib/gcodify/op.rb', line 20

def to_gcode
  "" # Return an empty string for testing purposes.
end