class BinaryParser::BuiltInTemplate::UInt
Public Instance Methods
*(other)
click to toggle source
# File lib/binary_parser/built_in_template/uint.rb, line 38 def *(other) if other.is_a?(UInt) self.to_i * other.to_i elsif other.is_a?(Integer) self.to_i * other else x, y = other.coerce(self) x * y end end
+(other)
click to toggle source
# File lib/binary_parser/built_in_template/uint.rb, line 27 def +(other) if other.is_a?(UInt) self.to_i + other.to_i elsif other.is_a?(Integer) self.to_i + other else x, y = other.coerce(self) x + y end end
-(other)
click to toggle source
# File lib/binary_parser/built_in_template/uint.rb, line 49 def -(other) if other.is_a?(UInt) self.to_i - other.to_i elsif other.is_a?(Integer) self.to_i - other else x, y = other.coerce(self) x - y end end
/(other)
click to toggle source
# File lib/binary_parser/built_in_template/uint.rb, line 60 def /(other) if other.is_a?(UInt) self.to_i / other.to_i elsif other.is_a?(Integer) self.to_i / other else x, y = other.coerce(self) x / y end end
<=>(other)
click to toggle source
# File lib/binary_parser/built_in_template/uint.rb, line 71 def <=>(other) if other.is_a?(UInt) self.to_i <=> other.to_i elsif other.is_a?(Integer) self.to_i <=> other else nil end end
[](bit_index)
click to toggle source
# File lib/binary_parser/built_in_template/uint.rb, line 15 def [](bit_index) self.to_i[bit_index] end
coerce(other)
click to toggle source
Calls superclass method
# File lib/binary_parser/built_in_template/uint.rb, line 19 def coerce(other) if other.is_a?(Integer) return other, self.to_i else super end end
content_description()
click to toggle source
# File lib/binary_parser/built_in_template/uint.rb, line 7 def content_description "#{self.to_i.to_s} (0x#{self.to_i.to_s(16)})" end
to_s(base=10)
click to toggle source
# File lib/binary_parser/built_in_template/uint.rb, line 11 def to_s(base=10) self.to_i.to_s(base) end