class BinaryParser::BuiltInTemplate::Binary

Public Instance Methods

==(other) click to toggle source
Calls superclass method
# File lib/binary_parser/built_in_template/binary.rb, line 14
def ==(other)
  if other.is_a?(Binary)
    self.to_s == other.to_s
  elsif other.is_a?(String)
    self.to_s == other
  else
    super
  end
end
content_description() click to toggle source
# File lib/binary_parser/built_in_template/binary.rb, line 4
def content_description
  chars = to_chars
  bytes = chars[0, 5].map{|i| sprintf("0x%02x", i)}.join(", ")
  return "[" + bytes + (chars.length > 5 ? ", ..." : "") + "]"
end
to_str() click to toggle source
# File lib/binary_parser/built_in_template/binary.rb, line 10
def to_str
  self.to_s
end