class DBus::Property

An (exported) property dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-properties

Attributes

access[R]

@return [Symbol] :read :write or :readwrite

name[R]

@return [Symbol] The name of the property, for example FooBar.

ruby_name[R]

@return [Symbol,nil] What to call at Ruby side.

(Always without the trailing `=`)
It is `nil` IFF representing a client-side proxy.
type[R]

@return [Type]

Public Class Methods

from_xml(xml_node) click to toggle source

@param xml_node [AbstractXML::Node] @return [Property]

# File lib/dbus/introspect.rb, line 307
def self.from_xml(xml_node)
  name = xml_node["name"].to_sym
  type = xml_node["type"]
  access = xml_node["access"].to_sym
  new(name, type, access, ruby_name: nil)
end
new(name, type, access, ruby_name:) click to toggle source
# File lib/dbus/introspect.rb, line 282
def initialize(name, type, access, ruby_name:)
  @name = name.to_sym
  type = DBus.type(type) unless type.is_a?(Type)
  @type = type
  @access = access
  @ruby_name = ruby_name
end

Public Instance Methods

readable?() click to toggle source

@return [Boolean]

# File lib/dbus/introspect.rb, line 291
def readable?
  access == :read || access == :readwrite
end
to_xml() click to toggle source

Return introspection XML string representation of the property.

# File lib/dbus/introspect.rb, line 301
def to_xml
  "    <property type=\"#{@type}\" name=\"#{@name}\" access=\"#{@access}\"/>\n"
end
writable?() click to toggle source

@return [Boolean]

# File lib/dbus/introspect.rb, line 296
def writable?
  access == :write || access == :readwrite
end