Class: Apscanner::Scanner

Inherits:
Object
  • Object
show all
Defined in:
lib/apscanner/scanner.rb

Instance Method Summary collapse

Constructor Details

#initialize(sensors_json) ⇒ Scanner

Returns a new instance of Scanner.



3
4
5
# File 'lib/apscanner/scanner.rb', line 3

def initialize(sensors_json)
  @sensors = sensors_json.map { |s| Sensor.new(s) }
end

Instance Method Details

#runObject



7
8
9
10
11
12
# File 'lib/apscanner/scanner.rb', line 7

def run
  @sensors.each do |sensor|
    sensor.scan
    yield(sensor) if block_given?
  end
end