Class: NumberPlate::SG::Generator

Inherits:
BaseGenerator show all
Includes:
Checksum
Defined in:
lib/number_plate/sg/generator.rb

Constant Summary

Constants included from Checksum

Checksum::CHECK_SUM, Checksum::MULTIPLIER

Instance Attribute Summary

Attributes inherited from BaseGenerator

#country

Instance Method Summary collapse

Methods included from Checksum

#checksum, #get_checksum_from_numbers, #numbers

Constructor Details

#initializeGenerator

Returns a new instance of Generator.



9
10
11
# File 'lib/number_plate/sg/generator.rb', line 9

def initialize
  @country = "SG"
end

Instance Method Details

#generateObject



13
14
15
# File 'lib/number_plate/sg/generator.rb', line 13

def generate
  letters + numerals + checksum
end

#lettersObject



21
22
23
# File 'lib/number_plate/sg/generator.rb', line 21

def letters 
  @letters = prefix + random_letters
end

#numeralsObject



25
26
27
# File 'lib/number_plate/sg/generator.rb', line 25

def numerals
  @numerals =  rand(1..9999).to_s
end

#prefixObject



17
18
19
# File 'lib/number_plate/sg/generator.rb', line 17

def prefix
  'S'
end