Class: DBus::EmitsChangedSignal
- Inherits:
-
Object
- Object
- DBus::EmitsChangedSignal
- Defined in:
- lib/dbus/emits_changed_signal.rb
Overview
Describes the behavior of PropertiesChanged signal, for a single property or for an entire interface.
The possible values are:
-
true: the signal is emitted with the value included.
-
:invalidates: the signal is emitted but the value is not included in the signal.
-
:const: the property never changes value during the lifetime of the object it belongs to, and hence the signal is never emitted for it (but clients can cache the value)
-
false: the signal won’t be emitted (clients should re-Get the property value)
The default is:
-
for an interface: true
-
for a property: what the parent interface specifies
Immutable once constructed.
Constant Summary collapse
- DEFAULT_ECS =
EmitsChangedSignal.new(true)
Instance Attribute Summary collapse
- #value ⇒ true, ... readonly
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
-
#initialize(value, interface: nil) ⇒ EmitsChangedSignal
constructor
A new instance of EmitsChangedSignal.
- #to_s ⇒ Object
-
#to_xml ⇒ String
Return introspection XML string representation.
Constructor Details
#initialize(value, interface: nil) ⇒ EmitsChangedSignal
Returns a new instance of EmitsChangedSignal.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/dbus/emits_changed_signal.rb', line 43 def initialize(value, interface: nil) if value.nil? raise ArgumentError, "Both arguments are nil" if interface.nil? @value = interface.emits_changed_signal.value else expecting = [true, false, :const, :invalidates] unless expecting.include?(value) raise ArgumentError, "Expecting one of #{expecting.inspect}. Seen #{value.inspect}" end @value = value end freeze end |
Instance Attribute Details
#value ⇒ true, ... (readonly)
36 37 38 |
# File 'lib/dbus/emits_changed_signal.rb', line 36 def value @value end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
72 73 74 75 76 77 78 |
# File 'lib/dbus/emits_changed_signal.rb', line 72 def ==(other) if other.is_a?(self.class) other.value == @value else other == value end end |
#to_s ⇒ Object
68 69 70 |
# File 'lib/dbus/emits_changed_signal.rb', line 68 def to_s @value.to_s end |
#to_xml ⇒ String
Return introspection XML string representation
62 63 64 65 66 |
# File 'lib/dbus/emits_changed_signal.rb', line 62 def to_xml return "" if @value == true " <annotation name=\"org.freedesktop.DBus.Property.EmitsChangedSignal\" value=\"#{@value}\"/>\n" end |