Class: AAMVA::Encoder

Inherits:
Object
  • Object
show all
Defined in:
lib/aamva/encoder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(standard:, data:) ⇒ Encoder

Returns a new instance of Encoder.



5
6
7
8
# File 'lib/aamva/encoder.rb', line 5

def initialize(standard:, data:)
  @standard = standard
  @data = data
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



3
4
5
# File 'lib/aamva/encoder.rb', line 3

def data
  @data
end

#standardObject (readonly)

Returns the value of attribute standard.



3
4
5
# File 'lib/aamva/encoder.rb', line 3

def standard
  @standard
end

Instance Method Details

#pdf417Object



14
15
16
17
18
19
20
# File 'lib/aamva/encoder.rb', line 14

def pdf417
  @pdf417 ||= begin
    require "pdf417"

    PDF417.new(string)
  end
end

#pngObject



22
23
24
# File 'lib/aamva/encoder.rb', line 22

def png
  @png ||= pdf417.to_chunky_png
end

#stringObject



10
11
12
# File 'lib/aamva/encoder.rb', line 10

def string
  "#{header}#{subfile_designators}#{subfiles}"
end