Class: DBus::Data::Int

Inherits:
Fixed show all
Defined in:
lib/dbus/data.rb

Overview

Represents integers

Direct Known Subclasses

Byte, Int16, Int32, Int64, UInt16, UInt32, UInt64

Instance Attribute Summary

Attributes inherited from Base

#value

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Fixed

fixed?, from_raw, #marshall

Methods inherited from Basic

basic?, from_typed, type, #type

Methods inherited from Base

#==, assert_type_matches_class, basic?, #eql?, fixed?, from_typed, #type, type_code

Constructor Details

#initialize(value) ⇒ Int

Returns a new instance of Int.

Parameters:

Raises:

  • RangeError



170
171
172
173
174
175
176
# File 'lib/dbus/data.rb', line 170

def initialize(value)
  value = value.value if value.is_a?(self.class)
  r = self.class.range
  raise RangeError, "#{value.inspect} is not a member of #{r}" unless r.member?(value)

  super(value)
end

Class Method Details

.rangeRange

Returns the full range of allowed values.

Returns:

  • (Range)

    the full range of allowed values



# File 'lib/dbus/data.rb', line 165