Class: DBus::Data::Fixed

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

Overview

A value that has a fixed size (unlike StringLike).

Direct Known Subclasses

Boolean, Double, Int

Instance Attribute Summary

Attributes inherited from Base

#value

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Basic

basic?, from_typed, type, #type

Methods inherited from Base

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

Constructor Details

This class inherits a constructor from DBus::Data::Base

Class Method Details

.fixed?Boolean

Returns:



141
142
143
# File 'lib/dbus/data.rb', line 141

def self.fixed?
  true
end

.from_raw(value, mode:) ⇒ Object

most Fixed types are valid whatever bits from the wire are used to initialize them

Parameters:

  • mode (:plain, :exact)


148
149
150
151
152
# File 'lib/dbus/data.rb', line 148

def self.from_raw(value, mode:)
  return value if mode == :plain

  new(value)
end

Instance Method Details

#marshall(endianness) ⇒ Object

Parameters:

  • endianness (:little, :big)


155
156
157
# File 'lib/dbus/data.rb', line 155

def marshall(endianness)
  [value].pack(self.class.format[endianness])
end