lib/zklib/user_management.rb
def decode_user_data(options)
      data = options[:data]

      {
        uid:      BinData::Uint16be.read(data[0..1]).snapshot,
        role:     BinData::Uint16be.read(data[2..3]).snapshot,
        password: data[4..11].split("\0").pop,
        name:     data[12..35].split("\0").pop,
        card_no:  BinData::Uint32le.read(data[36..39]).snapshot,
        user_id:  data[49..71].split("\0").pop
      }
    end
# Decode user data
# param  options
#        |_ data  User data to decode
Decode user data
param  options
|_ data  User data to decode
Decode user data param options |_ data User data to decode
def decode_user_data(options)
      data = options[:data]
      {
        uid:      BinData::Uint16be.read(data[0..1]).snapshot,
        role:     BinData::Uint16be.read(data[2..3]).snapshot,
        password: data[4..11].split("\0").pop,
        name:     data[12..35].split("\0").pop,
        card_no:  BinData::Uint32le.read(data[36..39]).snapshot,
        user_id:  data[49..71].split("\0").pop
      }
    end
def decode_user_data ( options ) data = options [ :data ] { uid : BinData :: Uint16be . read ( data [ 0 .. 1 ] ) . snapshot , role : BinData :: Uint16be . read ( data [ 2 .. 3 ] ) . snapshot , password : data [ 4 .. 11 ] . split ( "\0" ) . pop , name : data [ 12 .. 35 ] . split ( "\0" ) . pop , card_no : BinData :: Uint32le . read ( data [ 36 .. 39 ] ) . snapshot , user_id : data [ 49 .. 71 ] . split ( "\0" ) . pop } end
Decode user data
param  options
|_ data  User data to decode
Decode user data param options |_ data User data to decode
options