Class: HG::Finance::Stock
- Inherits:
-
Object
- Object
- HG::Finance::Stock
- Defined in:
- lib/hg/finance/stock.rb
Instance Attribute Summary collapse
-
#location ⇒ Object
Public: Location.
-
#name ⇒ Object
Public: Name.
-
#variation ⇒ Object
Public: Last util day variation.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Stock
constructor
A new instance of Stock.
- #inspect ⇒ Object
- #to_s(separator = ' - ') ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Stock
Returns a new instance of Stock.
19 20 21 22 23 24 25 26 |
# File 'lib/hg/finance/stock.rb', line 19 def initialize( = {}) if .count != 0 @name = [:name] if [:name] # @mic = options[:mic] if options[:mic] @location = [:location] if [:location] @variation = [:variation] if [:variation] end end |
Instance Attribute Details
#location ⇒ Object
Public: Location
14 15 16 |
# File 'lib/hg/finance/stock.rb', line 14 def location @location end |
#name ⇒ Object
Public: Name
8 9 10 |
# File 'lib/hg/finance/stock.rb', line 8 def name @name end |
#variation ⇒ Object
Public: Last util day variation
17 18 19 |
# File 'lib/hg/finance/stock.rb', line 17 def variation @variation end |
Instance Method Details
#inspect ⇒ Object
37 38 39 |
# File 'lib/hg/finance/stock.rb', line 37 def inspect self.to_s end |
#to_s(separator = ' - ') ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/hg/finance/stock.rb', line 28 def to_s separator = ' - ' to_return = [] to_return << "#{self.name} - #{self.location}" if self.name && self.location to_return << "#{Locale.get_format(:variation).to_s.capitalize}: " + self.variation.to_s if self.variation return to_return.join(separator) end |