Class: OpenHAB::Core::Things::Thing::ChannelsArray
- Defined in:
 - lib/openhab/core/things/thing.rb
 
Overview
Array wrapper class to allow searching a list of channels by channel id
Instance Method Summary collapse
- 
  
    
      #[](index)  ⇒ Channel? 
    
    
  
  
  
  
  
  
  
  
  
    
Allows indexing by both integer as an array or channel id acting like a hash.
 - 
  
    
      #initialize(thing, array)  ⇒ ChannelsArray 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of ChannelsArray.
 
Methods inherited from Array
Constructor Details
#initialize(thing, array) ⇒ ChannelsArray
Returns a new instance of ChannelsArray.
      70 71 72 73  | 
    
      # File 'lib/openhab/core/things/thing.rb', line 70 def initialize(thing, array) super(array) @thing = thing end  | 
  
Instance Method Details
#[](index) ⇒ Channel?
Allows indexing by both integer as an array or channel id acting like a hash.
      79 80 81 82 83 84  | 
    
      # File 'lib/openhab/core/things/thing.rb', line 79 def [](index) return @thing.get_channel(index) if index.is_a?(ChannelUID) return @thing.get_channel(index.to_str) if index.respond_to?(:to_str) super end  |