Class: DBus::Property

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

Overview

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, type, access, ruby_name:) ⇒ Property

Returns a new instance of Property.



283
284
285
286
287
288
# File 'lib/dbus/introspect.rb', line 283

def initialize(name, type, access, ruby_name:)
  @name = name.to_sym
  @type = type
  @access = access
  @ruby_name = ruby_name
end

Instance Attribute Details

#accessSymbol (readonly)

Returns :read :write or :readwrite.

Returns:

  • (Symbol)

    :read :write or :readwrite



276
277
278
# File 'lib/dbus/introspect.rb', line 276

def access
  @access
end

#nameSymbol (readonly)

Returns The name of the property, for example FooBar.

Returns:

  • (Symbol)

    The name of the property, for example FooBar.



272
273
274
# File 'lib/dbus/introspect.rb', line 272

def name
  @name
end

#ruby_nameSymbol? (readonly)

Returns What to call at Ruby side. (Always without the trailing ‘=`) It is `nil` IFF representing a client-side proxy.

Returns:

  • (Symbol, nil)

    What to call at Ruby side. (Always without the trailing ‘=`) It is `nil` IFF representing a client-side proxy.



281
282
283
# File 'lib/dbus/introspect.rb', line 281

def ruby_name
  @ruby_name
end

#typeSingleCompleteType (readonly)

Returns:



274
275
276
# File 'lib/dbus/introspect.rb', line 274

def type
  @type
end

Class Method Details

.from_xml(xml_node) ⇒ Property

Parameters:

  • xml_node (AbstractXML::Node)

Returns:



307
308
309
310
311
312
# 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

Instance Method Details

#readable?Boolean

Returns:

  • (Boolean)


291
292
293
# File 'lib/dbus/introspect.rb', line 291

def readable?
  access == :read || access == :readwrite
end

#to_xmlObject

Return introspection XML string representation of the property.



301
302
303
# File 'lib/dbus/introspect.rb', line 301

def to_xml
  "    <property type=\"#{@type}\" name=\"#{@name}\" access=\"#{@access}\"/>\n"
end

#writable?Boolean

Returns:

  • (Boolean)


296
297
298
# File 'lib/dbus/introspect.rb', line 296

def writable?
  access == :write || access == :readwrite
end