Sha256: 229ca2eae534aa9f73c6f49635ca807339231f1f9e7bba931d07fa89c9d95288

Contents?: true

Size: 554 Bytes

Versions: 4

Compression:

Stored size: 554 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'
      # QVCA (Liberty Interactive Corp)
      when 'QVCA'
        '0001355096'
      # LMCK (Liberty Media Corp)
      when 'LMCK'
        '0001560385'
      else
        @symbol
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
stock_index-0.8.3 lib/stock_index/symbol_parser.rb
stock_index-0.8.2 lib/stock_index/symbol_parser.rb
stock_index-0.8.1 lib/stock_index/symbol_parser.rb
stock_index-0.8.0 lib/stock_index/symbol_parser.rb