class RPi

Public Class Methods

new(x=[]) click to toggle source
# File lib/rpi.rb, line 10
def initialize(x=[])
  
  a = case x
  when Integer
    [x]    
  when Fixnum
    [x]
  when String
    [x]
  when Array
    x
  end
  
  @pins = a.map {|pin| RPiPinOut.new pin }
  
  def @pins.[](i)

    if i.to_i >= self.length then
      puts "RPi warning: RPiPinOut instance #{i.inspect} not found"
      PinX::Void.new
    else
      self.at(i)
    end 
  end    

end

Public Instance Methods

pin() click to toggle source
# File lib/rpi.rb, line 37
def pin()   @pins.first  end
pins() click to toggle source
# File lib/rpi.rb, line 38
def pins()  @pins        end