Class: RCGTK::User::OperandCollection
- Inherits:
- 
      Object
      
        - Object
- RCGTK::User::OperandCollection
 
- Includes:
- Enumerable
- Defined in:
- lib/rcgtk/value.rb
Overview
This class is used to access a User’s operands.
Instance Method Summary collapse
- 
  
    
      #[](index)  ⇒ Value? 
    
    
  
  
  
  
  
  
  
  
  
    Access the operand at the given index. 
- 
  
    
      #[]=(index, value)  ⇒ void 
    
    
  
  
  
  
  
  
  
  
  
    Set the operand at the given index. 
- 
  
    
      #each {|val| ... } ⇒ Enumerator 
    
    
  
  
  
  
  
  
  
  
  
    An iterator for each operand inside this collection. 
- 
  
    
      #initialize(user)  ⇒ OperandCollection 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of OperandCollection. 
- 
  
    
      #size  ⇒ Integer 
    
    
  
  
  
  
  
  
  
  
  
    Number of operands. 
Constructor Details
#initialize(user) ⇒ OperandCollection
Returns a new instance of OperandCollection.
| 230 231 232 | # File 'lib/rcgtk/value.rb', line 230 def initialize(user) @user = user end | 
Instance Method Details
#[](index) ⇒ Value?
Access the operand at the given index.
| 239 240 241 | # File 'lib/rcgtk/value.rb', line 239 def [](index) if (ptr = Bindings.get_operand(@user, index)).null? then nil else Value.new(ptr) end end | 
#[]=(index, value) ⇒ void
This method returns an undefined value.
Set the operand at the given index.
| 249 250 251 | # File 'lib/rcgtk/value.rb', line 249 def []=(index, value) Bindings.set_operand(@user, index, check_type(value, Value, 'value')) end | 
#each {|val| ... } ⇒ Enumerator
An iterator for each operand inside this collection.
| 258 259 260 261 262 263 264 | # File 'lib/rcgtk/value.rb', line 258 def each return to_enum(:each) unless block_given? self.size.times { |i| yield self[i] } self end | 
#size ⇒ Integer
Returns Number of operands.
| 267 268 269 | # File 'lib/rcgtk/value.rb', line 267 def size Bindings.get_num_operands(@user) end |