Sha256: 5a767be5812233a921a1d10bc1d37b6201ea52c89bbcfa4da683a8c776f8f6cf

Contents?: true

Size: 402 Bytes

Versions: 4

Compression:

Stored size: 402 Bytes

Contents

class SymbolParser

  def initialize(symbol)
    @symbol = symbol
  end

  def symbol_to_bsym
    if @symbol
      @symbol.sub('-', '/')
    else
      nil
    end
  end

  def bsym_to_cik
    case @symbol
      # BRK/B (Berkshire Hathaway Inc)
      when 'BRK/B'
        '0001067983'
      # BF/B (Brown-Forman Corp)
      when 'BF/B'
        '0000014693'
      else
        @symbol
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
stock_index-0.8.8 lib/stock_index/symbol_parser.rb
stock_index-0.8.7 lib/stock_index/symbol_parser.rb
stock_index-0.8.6 lib/stock_index/symbol_parser.rb
stock_index-0.8.5 lib/stock_index/symbol_parser.rb