Class: SerialNumber
- Inherits:
-
Object
- Object
- SerialNumber
- Defined in:
- lib/serial_number.rb
Constant Summary collapse
- @@prefix =
''
- @@number =
nil
Class Method Summary collapse
- .generate_new_number ⇒ Object
- .number ⇒ Object
- .number=(new_number) ⇒ Object
- .prefix=(prefix) ⇒ Object
- .to_s ⇒ Object
Class Method Details
.generate_new_number ⇒ Object
17 18 19 |
# File 'lib/serial_number.rb', line 17 def self.generate_new_number DateTime.now.strftime('%Y%m%d%H%M%S') end |
.number ⇒ Object
7 8 9 10 |
# File 'lib/serial_number.rb', line 7 def self.number @@number ||= generate_new_number "#{@@prefix}#{@@number}" end |
.number=(new_number) ⇒ Object
11 12 13 |
# File 'lib/serial_number.rb', line 11 def self.number=(new_number) @@number = new_number end |
.prefix=(prefix) ⇒ Object
14 15 16 |
# File 'lib/serial_number.rb', line 14 def self.prefix=(prefix) @@prefix = prefix end |
.to_s ⇒ Object
20 21 22 |
# File 'lib/serial_number.rb', line 20 def self.to_s number end |