Class: Netfira::WebConnect::Checksum

Inherits:
OctaWord
  • Object
show all
Defined in:
lib/netfira/web_connect/components/checksum.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from OctaWord

#as_json, #base64, #binary, #eql?, from_base64, from_binary, from_hex, #hex, #initialize, #inspect, #to_s

Constructor Details

This class inherits a constructor from Netfira::WebConnect::OctaWord

Class Method Details

.of(data) ⇒ Object



6
7
8
# File 'lib/netfira/web_connect/components/checksum.rb', line 6

def self.of(data)
  new Digest::MD5.digest(data)
end

Instance Method Details

#=~(what) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/netfira/web_connect/components/checksum.rb', line 10

def =~(what)
  if what.is_a?(self.class)
    b == what.b
  else
    b == self.class.of(what).b
  end
end