Class: DBus::Data::Basic

Inherits:
Base
  • Object
show all
Defined in:
lib/dbus/data.rb

Overview

A value that is not a Container.

Direct Known Subclasses

Fixed, StringLike

Instance Attribute Summary

Attributes inherited from Base

#value

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#==, assert_type_matches_class, #eql?, fixed?, #initialize, type_code

Constructor Details

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

Class Method Details

.basic?Boolean

Returns:



115
116
117
# File 'lib/dbus/data.rb', line 115

def self.basic?
  true
end

.from_typed(value, type:) ⇒ Basic

Parameters:

  • value (::Object)
  • type (Type)

Returns:



133
134
135
136
# File 'lib/dbus/data.rb', line 133

def self.from_typed(value, type:)
  assert_type_matches_class(type)
  new(value)
end

.typeType

Returns:



120
121
122
123
# File 'lib/dbus/data.rb', line 120

def self.type
  # memoize
  @type ||= Type.new(type_code).freeze
end

Instance Method Details

#typeObject



125
126
127
128
# File 'lib/dbus/data.rb', line 125

def type
  # The basic types can do this, unlike the containers
  self.class.type
end