Class: StockMarkit::Stock

Inherits:
Object
  • Object
show all
Defined in:
lib/stock-markit/stock.rb

Overview

Stock Object

Copyright

Copyright © 2016 Michael Heijmans

License

MIT

Author:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(symbol, name, exchange = nil) ⇒ Stock

Returns a new instance of Stock.

Parameters:

  • symbol (String)

    The stock’s ticker symbol

  • name (String)

    The name of the company

  • exchange (String) (defaults to: nil)

    Optional exchange string



19
20
21
22
23
# File 'lib/stock-markit/stock.rb', line 19

def initialize(symbol, name, exchange=nil)
  @symbol   = symbol
  @name     = name
  @exchange = exchange
end

Instance Attribute Details

#exchangeString (readonly)

The exchange the stock is traded on

Returns:

  • (String)

    the current value of exchange



13
14
15
# File 'lib/stock-markit/stock.rb', line 13

def exchange
  @exchange
end

#nameString (readonly)

The company name

Returns:

  • (String)

    the current value of name



13
14
15
# File 'lib/stock-markit/stock.rb', line 13

def name
  @name
end

#symbolString (readonly)

The Stock Symbol

Returns:

  • (String)

    the current value of symbol



13
14
15
# File 'lib/stock-markit/stock.rb', line 13

def symbol
  @symbol
end