<commit_before>#!/usr/bin/env ruby

class StockGrabber
  require 'net/http'

  def initialize(stock)
    @pricesheet = Net::HTTP.get('download.finance.yahoo.com', '/d/quotes.csv?s='+stock+'&f=snl1d1t1c1ohgv&e=.csv').chop.split(",")
  end
  
  def symbol
    @pricesheet[0].gsub("\"","")
  end
  
  def company
    @pricesheet[1].gsub("\"","")
  end
  
  def last_traded_price
    @pricesheet[2]
  end
  
  def last_traded_date
    @pricesheet[3].gsub("\"","")
  end
  
  def last_traded_time
    @pricesheet[4].gsub("\"","")
  end
  
  def change
    @pricesheet[5]
  end
  
  def opening_price
    @pricesheet[6]
  end
  
  def days_high
    @pricesheet[7]
  end
  
  def days_low
    @pricesheet[8]
  end
  
  def volume
    @pricesheet[9]
  end
  
  def exchange
    case
      when self.symbol[-2,2] == ".M"   then "Montreal"
      when self.symbol[-2,2] == ".V"   then "Vancouver"
      when self.symbol[-3,3] == ".TO"  then "Toronto"
      when self.symbol[-3,3] == ".AL"  then "Alberta"
      else "US"
    end
  end
  <commit_msg>Cleaned up to use accessors<commit_after>class StockGrabber
  require 'net/http'
  attr_accessor :symbol, :company, :last_traded_price, :last_traded_date, :last_traded_time, :change, :opening_price, :days_high, :days_low, :volume, :exchange

  def initialize(stock)
    pricesheet          = Net::HTTP.get('download.finance.yahoo.com', '/d/quotes.csv?s='+stock+'&f=snl1d1t1c1ohgv&e=.csv').chop.split(",")
    @symbol             = pricesheet[0].gsub("\"","")
    @company            = pricesheet[1].gsub("\"","")
    @last_traded_price  = pricesheet[2]
    @last_traded_date   = pricesheet[3].gsub("\"","")
    @last_traded_time   = pricesheet[4].gsub("\"","")
    @change             = pricesheet[5]
    @opening_price      = pricesheet[6]
    @days_high          = pricesheet[7]
    @days_low           = pricesheet[8]
    @volume             = pricesheet[9]
    @exchange           = get_exchange
  end

  def get_exchange
    case
      when self.symbol[-2,2] == ".M"   then "Montreal"
      when self.symbol[-2,2] == ".V"   then "Vancouver"
      when self.symbol[-3,3] == ".TO"  then "Toronto"
      when self.symbol[-3,3] == ".AL"  then "Alberta"
      else "US"
    end
  end
{'fraction_non_alphanumeric': 0.16434038721296712, 'fraction_numerical': 0.01981089599279604, 'mean_word_length': 2.607142857142857, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2528551', 'n_tokens_mistral': 877, 'n_tokens_neox': 866, 'n_words': 154}