class SIGADParse

Public Class Methods

new(input, field) click to toggle source
# File lib/sigadparse.rb, line 4
def initialize(input, field)
  @input = JSON.parse(input)
  @field = field
end

Public Instance Methods

match() click to toggle source
# File lib/sigadparse.rb, line 9
def match
  matcharr = Array.new
  @input.each do |i|
    if i[@field]
      i[:sigads] = i[@field].scan(/(?:US|CA|UK|NZ|AU|DS|us|ca|uk|nz|au|ds)[a-zA-Z]?-\d(?:\w|-|\*){1,6}/)
      matcharr.push(i)
    end
  end
  JSON.pretty_generate(matcharr)
end