class RCGTK::Value::AttrCollection
This class is used to access a {Value Value’s} attributes.
Public Class Methods
new(value)
click to toggle source
@param [Value] value Value
for which this is a proxy.
# File lib/rcgtk/value.rb, line 158 def initialize(value) @attributes = Array.new @value = value end
Public Instance Methods
add(attribute)
click to toggle source
Add the given attribute to a value.
@see Bindings
.enum_attribute
@param [Symbol] attribute Attribute to add.
@return [void]
# File lib/rcgtk/value.rb, line 170 def add(attribute) if not @attributes.include?(attribute) @attributes << attribute Bindings.send(@@add_method, @value, attribute) end end
Also aliased as: '<<'
include?(attribute)
click to toggle source
Test to see if an attribute has been set on a value.
@see Bindings
.enum_attribute
@param [Symbol] attribute Attribute to check.
@return [Boolean]
# File lib/rcgtk/value.rb, line 185 def include?(attribute) @attributes.include?(attribute) end
remove(attribute)
click to toggle source
Remove the given attribute from a value.
@see Bindings
.enum_attribute
@param [Symbol] attribute Attribute to remove.
@return [void]
# File lib/rcgtk/value.rb, line 196 def remove(attribute) if @attributes.include?(attribute) @attributes.delete(attribute) Bindings.send(@@del_method, @value, attribute) end end
Also aliased as: '>>'
to_s()
click to toggle source
@return [String] Textual representation of the enabled attributes.
# File lib/rcgtk/value.rb, line 205 def to_s @attributes.to_s end