module WxAlert

Constants

VERSION

Public Class Methods

new_idx(code, print_errors = false) click to toggle source

Sets up new AlertsIndex *and updates* said index. Parameter:

code of the new index (State, FIPS, UGC)

Returns the newly updated index

# File lib/WxAlert.rb, line 18
def self.new_idx(code, print_errors = false)
  new_idx = AlertsIndex.new code
  new_idx.update
  new_idx
end
set_idx_code(code) click to toggle source

Sets up new AlertsIndex. DOES NOT UPDATE Parameter:

code of the new index (State, FIPS, UGC)

Returns the newly set index

DOES NOT VALIDATE CODE Must run new_idx.update

# File lib/WxAlert.rb, line 31
def self.set_idx_code(code)
  new_idx = AlertsIndex.new code
  new_idx
end
valid_code?(code) click to toggle source

Validates State, FIPS, and UGC codes Parameter:

code to test (State, FIPS, UGC)

Returns a boolean of the validity of the code.

# File lib/WxAlert.rb, line 40
def self.valid_code?(code)
  # do you even string
  return false unless code.is_a? String

  test_idx = new_idx code
  test_idx.update
  test_idx.index != ['Error']
end