# 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
    107 def self.assert_type_matches_class(type)
    108   raise ArgumentError, "Expecting #{type_code.inspect} for class #{self}, got #{type.sigtype.inspect}" \
    109     unless type.sigtype == type_code
    110 end

new(value) click to toggle source

Child classes must validate value.

       # File lib/dbus/data.rb
    84 def initialize(value)
    85   @value = value
    86 end

### Public Instance Methods

==(other) click to toggle source

       # File lib/dbus/data.rb
    88 def ==(other)
    89   @value == if other.is_a?(Base)
    90               other.value
    91             else
    92               other
    93             end
    94 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
     99 def eql?(other)
    100   return false unless other.class == self.class
    101
    102   other.value.eql?(@value)
    103   # TODO: this should work, now check derived classes, exact_value
    104 end