Class: RTicker::Entry

Inherits:
Object
  • Object
show all
Defined in:
lib/rticker/entry.rb

Overview

Parent class to represent all types of ticker entries to watch. The classes that subclass from Entry are: Equity, Currency, Future, and Option.

Direct Known Subclasses

Currency, Equity, Future, Option

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(symbol, description = nil, purchase_count = nil, purchase_price = nil, bold = false) ⇒ Entry

Returns a new instance of Entry.



26
27
28
29
30
31
32
33
# File 'lib/rticker/entry.rb', line 26

def initialize (symbol, description=nil, purchase_count=nil, purchase_price=nil, bold=false)
  @symbol = symbol
  @description = description
  @purchase_count = purchase_count
  @purchase_price = purchase_price
  @bold = bold
  @last_changed = nil
end

Instance Attribute Details

#boldObject Also known as: bold?

Returns the value of attribute bold.



22
23
24
# File 'lib/rticker/entry.rb', line 22

def bold
  @bold
end

#curr_valueObject

Returns the value of attribute curr_value.



22
23
24
# File 'lib/rticker/entry.rb', line 22

def curr_value
  @curr_value
end

#descriptionObject

etc.) @description is an optional string that can give a more user-friendly description of a symbol. If a description is not provided, the symbol itself is displayed to the user. If the user provides information on having purchased an entry (for example AAPL stock), the user may specify how many via @purchase_count (in this case how many shares), and for how much via @purchase_price (in this case how much paid per share). A user can specify a negative this entry should stand apart from other entries when displayed to the user.



21
22
23
# File 'lib/rticker/entry.rb', line 21

def description
  @description
end

#last_changedObject

Returns the value of attribute last_changed.



22
23
24
# File 'lib/rticker/entry.rb', line 22

def last_changed
  @last_changed
end

#purchase_countObject

etc.) @description is an optional string that can give a more user-friendly description of a symbol. If a description is not provided, the symbol itself is displayed to the user. If the user provides information on having purchased an entry (for example AAPL stock), the user may specify how many via @purchase_count (in this case how many shares), and for how much via @purchase_price (in this case how much paid per share). A user can specify a negative this entry should stand apart from other entries when displayed to the user.



21
22
23
# File 'lib/rticker/entry.rb', line 21

def purchase_count
  @purchase_count
end

#purchase_priceObject

etc.) @description is an optional string that can give a more user-friendly description of a symbol. If a description is not provided, the symbol itself is displayed to the user. If the user provides information on having purchased an entry (for example AAPL stock), the user may specify how many via @purchase_count (in this case how many shares), and for how much via @purchase_price (in this case how much paid per share). A user can specify a negative this entry should stand apart from other entries when displayed to the user.



21
22
23
# File 'lib/rticker/entry.rb', line 21

def purchase_price
  @purchase_price
end

#symbolObject

etc.) @description is an optional string that can give a more user-friendly description of a symbol. If a description is not provided, the symbol itself is displayed to the user. If the user provides information on having purchased an entry (for example AAPL stock), the user may specify how many via @purchase_count (in this case how many shares), and for how much via @purchase_price (in this case how much paid per share). A user can specify a negative this entry should stand apart from other entries when displayed to the user.



21
22
23
# File 'lib/rticker/entry.rb', line 21

def symbol
  @symbol
end