class IDL::Type::Integer
Public Class Methods
bits()
click to toggle source
# File lib/ridl/type.rb, line 155 def self.bits self::BITS end
is_unsigned?()
click to toggle source
# File lib/ridl/type.rb, line 151 def self.is_unsigned? self::Range.first.zero? end
newclass(range, bits)
click to toggle source
# File lib/ridl/type.rb, line 179 def Integer.newclass(range, bits) k = Class.new(self) k.const_set('Range', range) k.const_set('BITS', bits) k end
Public Instance Methods
in_range?(val)
click to toggle source
# File lib/ridl/type.rb, line 171 def in_range?(val) val >= self.min && val <= self.max end
max()
click to toggle source
# File lib/ridl/type.rb, line 167 def max self.class::Range.last end
min()
click to toggle source
# File lib/ridl/type.rb, line 163 def min self.class::Range.first end
narrow(obj)
click to toggle source
# File lib/ridl/type.rb, line 145 def narrow(obj) typeerror(obj) unless ::Integer === obj typeerror(obj) unless self.class::Range === obj obj end
next(val)
click to toggle source
# File lib/ridl/type.rb, line 175 def next(val) val < self.max ? val + 1 : self.min end
range_length()
click to toggle source
# File lib/ridl/type.rb, line 159 def range_length 1 + (self.class::Range.last - self.class::Range.first) end