Skip to content

v2.0.0

Compare
Choose a tag to compare
@stakach stakach released this 01 Feb 04:26
· 11 commits to master since this release

fully backwards compatible with deprecation warnings
replaces the old syntax with more crystal like syntax:

# OLD
class VerifyData < BinData
  endian big

  uint8 :size, default: 10_u8
  bytes :bytes, length: ->{ size }
  uint8 :checksum, verify: ->{ checksum == bytes.reduce(0) { |acc, i| acc + i } }
end

# NEW
class VerifyData < BinData
  endian big

  field size : UInt8 = 10_u8
  field bytes : Bytes, length: ->{ size }
  field checksum : UInt8, verify: ->{ checksum == bytes.reduce(0) { |acc, i| acc + i } }
end