Class: DBus::Property
- Inherits:
-
Object
- Object
- DBus::Property
- Defined in:
- lib/dbus/introspect.rb
Overview
An (exported) property dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-properties
Instance Attribute Summary collapse
-
#access ⇒ Symbol
readonly
:read :write or :readwrite.
-
#name ⇒ Symbol
readonly
The name of the property, for example FooBar.
-
#ruby_name ⇒ Symbol?
readonly
What to call at Ruby side.
- #type ⇒ Type readonly
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, type, access, ruby_name:) ⇒ Property
constructor
A new instance of Property.
- #readable? ⇒ Boolean
-
#to_xml ⇒ Object
Return introspection XML string representation of the property.
- #writable? ⇒ Boolean
Constructor Details
Instance Attribute Details
#access ⇒ Symbol (readonly)
276 277 278 |
# File 'lib/dbus/introspect.rb', line 276 def access @access end |
#name ⇒ Symbol (readonly)
272 273 274 |
# File 'lib/dbus/introspect.rb', line 272 def name @name end |
#ruby_name ⇒ Symbol? (readonly)
281 282 283 |
# File 'lib/dbus/introspect.rb', line 281 def ruby_name @ruby_name end |
#type ⇒ Type (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_xml ⇒ Object
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 |