Class: RBZK::Finger
- Inherits:
-
Object
- Object
- RBZK::Finger
- Defined in:
- lib/rbzk/finger.rb
Instance Attribute Summary collapse
-
#fid ⇒ Object
Returns the value of attribute fid.
-
#size ⇒ Object
Returns the value of attribute size.
-
#template ⇒ Object
Returns the value of attribute template.
-
#uid ⇒ Object
Returns the value of attribute uid.
-
#valid ⇒ Object
Returns the value of attribute valid.
Instance Method Summary collapse
-
#initialize(uid, fid, valid, template = '') ⇒ Finger
constructor
A new instance of Finger.
-
#repack ⇒ Object
Pack the finger data into a binary string (full data).
-
#repack_only ⇒ Object
Pack only the template data into a binary string.
- #to_s ⇒ Object
Constructor Details
#initialize(uid, fid, valid, template = '') ⇒ Finger
Returns a new instance of Finger.
7 8 9 10 11 12 13 |
# File 'lib/rbzk/finger.rb', line 7 def initialize(uid, fid, valid, template = '') @uid = uid @fid = fid @valid = valid @template = template @size = template.length end |
Instance Attribute Details
#fid ⇒ Object
Returns the value of attribute fid.
5 6 7 |
# File 'lib/rbzk/finger.rb', line 5 def fid @fid end |
#size ⇒ Object
Returns the value of attribute size.
5 6 7 |
# File 'lib/rbzk/finger.rb', line 5 def size @size end |
#template ⇒ Object
Returns the value of attribute template.
5 6 7 |
# File 'lib/rbzk/finger.rb', line 5 def template @template end |
#uid ⇒ Object
Returns the value of attribute uid.
5 6 7 |
# File 'lib/rbzk/finger.rb', line 5 def uid @uid end |
#valid ⇒ Object
Returns the value of attribute valid.
5 6 7 |
# File 'lib/rbzk/finger.rb', line 5 def valid @valid end |
Instance Method Details
#repack ⇒ Object
Pack the finger data into a binary string (full data)
16 17 18 |
# File 'lib/rbzk/finger.rb', line 16 def repack [@size + 6, @uid, @fid, @valid].pack('S<S<CC') + @template end |
#repack_only ⇒ Object
Pack only the template data into a binary string
21 22 23 |
# File 'lib/rbzk/finger.rb', line 21 def repack_only [@size].pack('S<') + @template end |
#to_s ⇒ Object
25 26 27 |
# File 'lib/rbzk/finger.rb', line 25 def to_s "#{@uid} #{@fid} #{@valid} #{@template.length}" end |