class EaSSL::Serial
- Author
-
Chris Andrews (chris@nodnol.org)
- Copyright
-
Copyright © 2011 Chris Andrews
- License
-
Distributes under the same terms as Ruby
Attributes
next[R]
Public Class Methods
load(serial_file_path)
click to toggle source
# File lib/eassl/serial.rb, line 13 def self.load(serial_file_path) hex_string = (File.read(serial_file_path)) self.new(:next => Integer("0x#{hex_string}"), :path => serial_file_path) end
new(options = {})
click to toggle source
# File lib/eassl/serial.rb, line 8 def initialize(options = {}) @next = options[:next] @path = options[:path] end
Public Instance Methods
issue_serial()
click to toggle source
# File lib/eassl/serial.rb, line 27 def issue_serial @next = @next + 1 @next - 1 end
save!()
click to toggle source
# File lib/eassl/serial.rb, line 18 def save! if @path hex_string = sprintf("%04X", @next) File.open(@path, 'w') do |io| io.write "#{hex_string}\n" end end end