Class: Device::Signature

Inherits:
Object
  • Object
show all
Defined in:
lib/device/signature.rb

Constant Summary collapse

FILE =
'./shared/device.sig'
CONVERTED =
1
FILE_NOT_FOUND =
2
IS_THE_SAME =
3

Class Method Summary collapse

Class Method Details

.convertObject



11
12
13
14
15
16
17
18
19
20
# File 'lib/device/signature.rb', line 11

def self.convert
  load
  return FILE_NOT_FOUND unless @file

  if must_convert?
    @file.update_attributes({ 'signer' => DaFunk::ParamsDat.file['signer'] })
    return CONVERTED
  end
  IS_THE_SAME
end

.loadObject



26
27
28
# File 'lib/device/signature.rb', line 26

def self.load
  @file = FileDb.new FILE
end

.must_convert?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/device/signature.rb', line 22

def self.must_convert?
  DaFunk::ParamsDat.file['signer'] && DaFunk::ParamsDat.file['signer'] != @file['signer']
end