Class: ATSPI::StateSet
- Inherits:
-
Object
- Object
- ATSPI::StateSet
- Extended by:
- Forwardable
- Defined in:
- lib/atspi/state_set.rb
Overview
ATSPI::StateSet wraps libatspi’s AtspiStateSet
Lifecycle collapse
- #initialize(*states) ⇒ StateSet constructor
Modification collapse
-
#add(*states) ⇒ self
Adds states to the set.
-
#remove(*states) ⇒ self
Removes states from the set.
Queries collapse
-
#contains?(state) ⇒ true, false
Checks if it contains the given state.
-
#difference_to(state_set) ⇒ StateSet
(also: #^)
Returns the difference between it and another set.
-
#empty? ⇒ true, false
Checks if it is empty.
-
#equals?(state_set) ⇒ true, false
(also: #==)
Checks if it equals another set.
Representations collapse
-
#inspect ⇒ String
Itself as an inspectable string.
-
#to_a ⇒ Array<Symbol>
The states it contains.
Constructor Details
Instance Method Details
#add(*states) ⇒ self
Adds states to the set
43 44 45 46 |
# File 'lib/atspi/state_set.rb', line 43 def add(*states) states.each{ |state| @native.add(state) } self end |
#contains?(state) ⇒ true, false
Checks if it contains the given state
80 81 82 |
# File 'lib/atspi/state_set.rb', line 80 def contains?(state) @native.contains(state) end |
#difference_to(state_set) ⇒ StateSet Also known as: ^
Returns the difference between it and another set
106 107 108 |
# File 'lib/atspi/state_set.rb', line 106 def difference_to(state_set) StateSet.new_from_native @native.compare(state_set.__send__(:native)) end |
#empty? ⇒ true, false
Checks if it is empty
92 93 94 |
# File 'lib/atspi/state_set.rb', line 92 def empty? @native.is_empty end |
#equals?(state_set) ⇒ true, false Also known as: ==
Checks if it equals another set
121 122 123 |
# File 'lib/atspi/state_set.rb', line 121 def equals?(state_set) @native.equals state_set.__send__(:native) end |
#inspect ⇒ String
Returns itself as an inspectable string.
136 137 138 |
# File 'lib/atspi/state_set.rb', line 136 def inspect "#<#{self.class.name}:0x#{'%x14' % __id__} @states=#{to_a.inspect}>" end |
#remove(*states) ⇒ self
Removes states from the set
61 62 63 64 |
# File 'lib/atspi/state_set.rb', line 61 def remove(*states) states.each{ |state| @native.remove(state) } self end |
#to_a ⇒ Array<Symbol>
Returns the states it contains.
131 132 133 |
# File 'lib/atspi/state_set.rb', line 131 def to_a @native.states.to_a end |