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
@return [::Object] a valid value, plain-Ruby typed. @see Data::Container#exact_value
Public Class Methods
Source
# 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
@param type [Type]
Source
# File lib/dbus/data.rb, line 84 def initialize(value) @value = value end
Child classes must validate value.
Public Instance Methods
Source
# File lib/dbus/data.rb, line 88 def ==(other) @value == if other.is_a?(Base) other.value else other end end
Source
# 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
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