Class: QrForge::Components::ForgeComponent

Inherits:
Object
  • Object
show all
Defined in:
lib/qr_forge/components/forge_component.rb

Overview

Base class for all components in the QR code design.

Instance Method Summary collapse

Constructor Details

#initialize(xml_builder:, test_id: nil) ⇒ ForgeComponent

Returns a new instance of ForgeComponent.

Parameters:

  • xml_builder (Nokogiri::XML::Builder)


10
11
12
13
# File 'lib/qr_forge/components/forge_component.rb', line 10

def initialize(xml_builder:, test_id: nil)
  @xml_builder = xml_builder
  @test_id = test_id
end

Instance Method Details

#draw(y:, x:, quiet_zone:, area:, **_) ⇒ Object

TODO: For modules pass the next and prev module to change design based on if there is another module next or behind

Parameters:

  • y (Integer)

    The row index

  • x (Integer)

    The col index

  • quiet_zone (Integer)

    The padding around the QR code

  • area (Integer)

    width and height of the area to draw (width and height are equal)

Raises:

  • (NotImplementedError)


21
22
23
# File 'lib/qr_forge/components/forge_component.rb', line 21

def draw(y:, x:, quiet_zone:, area:, **_)
  raise NotImplementedError, "FinderBorder::Base subclasses must implement `draw`"
end