class HSMR::Component
Attributes
key[R]
length[R]
Public Class Methods
new(key=nil, length=DOUBLE)
click to toggle source
# File lib/hsmr/component.rb, line 11 def initialize(key=nil, length=DOUBLE) ## Should check for odd parity if key.nil? key = generate(length) else key=key.gsub(/ /,'') #raise TypeError, "Component argument expected" unless other.is_a? Component end @key = key.unpack('a2'*(key.length/2)).map{|x| x.hex}.pack('c'*(key.length/2)) @length = @key.length @key = @key end
Public Instance Methods
component()
click to toggle source
# File lib/hsmr/component.rb, line 7 def component @key end