class DBus::Data::Base
The base class for explicitly typed values.
A value is either {Basic} or a {Container}. {Basic} values are either {Fixed}-size or {StringLike}.
Attributes
value[R]
@return [::Object] a valid value, plain-Ruby typed. @see Data::Container#exact_value
Public Class Methods
assert_type_matches_class(type)
click to toggle source
@param type [Type]
# File lib/dbus/data.rb, line 107 def self.assert_type_matches_class(type) raise ArgumentError, "Expecting #{type_code.inspect} for class #{self}, got #{type.sigtype.inspect}" \ unless type.sigtype == type_code end
new(value)
click to toggle source
Child classes must validate value.
# File lib/dbus/data.rb, line 84 def initialize(value) @value = value end
Public Instance Methods
==(other)
click to toggle source
# File lib/dbus/data.rb, line 88 def ==(other) @value == if other.is_a?(Base) other.value else other end end
eql?(other)
click to toggle source
Hash key equality See ruby-doc.org/core-3.0.0/Object.html#method-i-eql-3F Stricter than ==
(RSpec: eq), 1==1.0 but 1.eql(1.0)->false
# File lib/dbus/data.rb, line 99 def eql?(other) return false unless other.class == self.class other.value.eql?(@value) # TODO: this should work, now check derived classes, exact_value end