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 ⇒ SingleCompleteType 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
#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
#access ⇒ Symbol (readonly)
Returns :read :write or :readwrite.
276 277 278 |
# File 'lib/dbus/introspect.rb', line 276 def access @access end |
#name ⇒ Symbol (readonly)
Returns The name of the property, for example FooBar.
272 273 274 |
# File 'lib/dbus/introspect.rb', line 272 def name @name end |
#ruby_name ⇒ Symbol? (readonly)
Returns 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 |
#type ⇒ SingleCompleteType (readonly)
274 275 276 |
# File 'lib/dbus/introspect.rb', line 274 def type @type end |
Class Method Details
.from_xml(xml_node) ⇒ Property
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
291 292 293 |
# File 'lib/dbus/introspect.rb', line 291 def readable? access == :read || access == :readwrite end |
#to_xml ⇒ Object
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
296 297 298 |
# File 'lib/dbus/introspect.rb', line 296 def writable? access == :write || access == :readwrite end |