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



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

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

Instance Attribute Details

#accessSymbol (readonly)



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

def access
  @access
end

#nameSymbol (readonly)



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

def name
  @name
end

#ruby_nameSymbol? (readonly)



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

def ruby_name
  @ruby_name
end

#typeType (readonly)



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

def type
  @type
end

Class Method Details

.from_xml(xml_node) ⇒ Property



308
309
310
311
312
313
# File 'lib/dbus/introspect.rb', line 308

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



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

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

#to_xmlObject

Return introspection XML string representation of the property.



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

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

#writable?Boolean



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

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