Sha256: 9f85c667ca8ff49186b5e4a786b3c0b706550a10569de61b6cb469db3305a3bf

Contents?: true

Size: 478 Bytes

Versions: 6

Compression:

Stored size: 478 Bytes

Contents

class AccessPointList
  include WpaCliRuby

  def initialize(cli_client = WpaCli.new)
    cli_client.scan
    @access_points = cli_client.scan_results
  end

  def access_points
    @access_points.
      group_by {|network| network.ssid}.
      map {|ssid, network_group| network_group}.
      map {|network_group| network_group.sort_by { |network| network.signal_level}.reverse.take(1)}.
      flatten.
      sort_by { |network| network.signal_level }.
      reverse
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
wpa_cli_web-0.0.6 lib/wpa_cli_web/access_point_list.rb
wpa_cli_web-0.0.5 lib/wpa_cli_web/access_point_list.rb
wpa_cli_web-0.0.4 lib/wpa_cli_web/access_point_list.rb
wpa_cli_web-0.0.3 lib/wpa_cli_web/access_point_list.rb
wpa_cli_web-0.0.2 lib/wpa_cli_web/access_point_list.rb
wpa_cli_web-0.0.1 lib/wpa_cli_web/access_point_list.rb