Sha256: 96c4c610024c29ea8ba71f235cdf76bfa6002d5f08c8782d40030f6f263fc74b

Contents?: true

Size: 632 Bytes

Versions: 3

Compression:

Stored size: 632 Bytes

Contents

class Mic

  class Search

    def initialize
      @a = []
      CSV.foreach(Mic::FILE) do |row|
        h = {}
        h[:mic] = row[2]
        h[:acronym] = row[6]
        h[:market_name] = row[5]
        h[:market_type] = row[4]
        h[:operating_mic] = row[3]
        h[:country_code] = row[1]
        h[:country_name] = row[0]
        h[:city] = row[7]
        h[:website] = row[8]
        @a << h
      end
    end

    def select_by(symbol, string, include_segments)
      @a = @a.select{ |m| m[:market_type] == 'O' } unless include_segments
      @a.select{ |m| m[symbol] =~ Regexp.new(string, 'i') }
    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mic-1.0.1 lib/mic/search.rb
mic-1.0.0 lib/mic/search.rb
mic-0.9.0 lib/mic/search.rb