Sha256: d7767391f24d27f359a7de9883b397f383237e53714822a1300dbd3c91e86571

Contents?: true

Size: 856 Bytes

Versions: 94

Compression:

Stored size: 856 Bytes

Contents

module Origen
  module Pins
    class PowerPin < Pin
      # Set the operating voltage for the pin, can be a single value or an array
      def voltage=(val)
        @voltages = [val].flatten.uniq
      end

      # Like voltages but if there is only one voltage known then it will be returned
      # directly instead of being wrapped in an array.
      # If no voltages are known this returns nil whereas voltages will return an
      # empty array.
      # For more than one voltages present this behaves like an alias of voltages.
      def voltage
        if voltages.size > 0
          if voltages.size > 1
            voltages
          else
            voltages.first
          end
        end
      end

      # Returns an array of known operating voltages for the given pin
      def voltages
        @voltages ||= []
      end
    end
  end
end

Version data entries

94 entries across 94 versions & 1 rubygems

Version Path
origen-0.7.45 lib/origen/pins/power_pin.rb
origen-0.7.44 lib/origen/pins/power_pin.rb
origen-0.7.43 lib/origen/pins/power_pin.rb
origen-0.7.42 lib/origen/pins/power_pin.rb
origen-0.7.41 lib/origen/pins/power_pin.rb
origen-0.7.40 lib/origen/pins/power_pin.rb
origen-0.7.39 lib/origen/pins/power_pin.rb
origen-0.7.38 lib/origen/pins/power_pin.rb
origen-0.7.37 lib/origen/pins/power_pin.rb
origen-0.7.36 lib/origen/pins/power_pin.rb
origen-0.7.35 lib/origen/pins/power_pin.rb
origen-0.7.34 lib/origen/pins/power_pin.rb
origen-0.7.33 lib/origen/pins/power_pin.rb
origen-0.7.32 lib/origen/pins/power_pin.rb
origen-0.7.31 lib/origen/pins/power_pin.rb
origen-0.7.30 lib/origen/pins/power_pin.rb
origen-0.7.29 lib/origen/pins/power_pin.rb
origen-0.7.28 lib/origen/pins/power_pin.rb
origen-0.7.27 lib/origen/pins/power_pin.rb
origen-0.7.26 lib/origen/pins/power_pin.rb