Sha256: d62be78cb0a1ec6b129057e5b90d059b8171893d4ef8ddf8a261385f4fcc6411
Contents?: true
Size: 1.4 KB
Versions: 3
Compression:
Stored size: 1.4 KB
Contents
module PulseToolbox module Sensor module Mixins module Iterators # Executes block for each group # @yieldparam group [Symbol] group name def each_group sensors_config.each_key do |group| yield(group) end end # Executes block for each group # @yieldparam group [Symbol] group name # @yieldparam title [String] group title def each_group_with_title sensors_config.each_key do |group| yield(group, sensors_config[group][:title] || group) end end # Executes block for each sensor in group # @param group [Symbol] group name # @yieldparam sensor [Symbol] sensor name def each_sensor_in_group(group) sensors_config[group][:sensors].each_key do |name| sensor = get_sensor(group, name) yield(sensor) end end # Executes block for each sensor # @yieldparam sensor [Symbol] sensor name def each_sensor each_group do |group| each_sensor_in_group(group) do |sensor| yield(sensor) end end end # Returns all sensors from config # @return [Array<Symbol>] sensors list def sensors list = [] each_sensor {|s| list << s} list end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems