class Sensors::Chips

Defined in:

chips.cr

Class Method Summary

Class Method Detail

def self.all #

[View source]
def self.each(match : Chip, &block : Chip -> _) : Void #

[View source]
def self.each(&block : Chip -> _) : Void #
Description copied from module Indexable(Sensors::Chip)

Calls the given block once for each element in self, passing that element as a parameter.

a = ["a", "b", "c"]
a.each { |x| print x, " -- " }

produces:

a -- b -- c --

[View source]
def self.each_with_index(match : Chip, &block : Int32, Chip -> _) : Void #

[View source]
def self.each_with_index(&block : Int32, Chip -> _) : Void #
Description copied from module Enumerable(Sensors::Chip)

Iterates over the collection, yielding both the elements and their index.

["Alice", "Bob"].each_with_index do |user, i|
  puts "User ##{i}: #{user}"
end

Prints:

User # 0: Alice
User # 1: Bob

Accepts an optional offset parameter, which tells it to start counting from there. So, a more human friendly version of the previous snippet would be:

["Alice", "Bob"].each_with_index(1) do |user, i|
  puts "User ##{i}: #{user}"
end

Which would print:

User # 1: Alice
User # 2: Bob

[View source]
def self.matching(match : Chip) #

[View source]