Class: Crash
- Inherits:
-
Object
- Object
- Crash
- Defined in:
- lib/sp500_analyzer/crash.rb
Instance Attribute Summary collapse
-
#bottom ⇒ Object
readonly
Returns the value of attribute bottom.
-
#crash_period ⇒ Object
readonly
Returns the value of attribute crash_period.
-
#peak ⇒ Object
readonly
Returns the value of attribute peak.
-
#recovery_point ⇒ Object
Returns the value of attribute recovery_point.
Instance Method Summary collapse
-
#initialize(peak, bottom) ⇒ Crash
constructor
A new instance of Crash.
- #set_recovery ⇒ Object
Constructor Details
#initialize(peak, bottom) ⇒ Crash
Returns a new instance of Crash.
8 9 10 11 12 13 |
# File 'lib/sp500_analyzer/crash.rb', line 8 def initialize(peak, bottom) @peak = peak @bottom = bottom @crash_period = bottom.id - peak.id set_recovery end |
Instance Attribute Details
#bottom ⇒ Object (readonly)
Returns the value of attribute bottom.
5 6 7 |
# File 'lib/sp500_analyzer/crash.rb', line 5 def bottom @bottom end |
#crash_period ⇒ Object (readonly)
Returns the value of attribute crash_period.
5 6 7 |
# File 'lib/sp500_analyzer/crash.rb', line 5 def crash_period @crash_period end |
#peak ⇒ Object (readonly)
Returns the value of attribute peak.
5 6 7 |
# File 'lib/sp500_analyzer/crash.rb', line 5 def peak @peak end |
#recovery_point ⇒ Object
Returns the value of attribute recovery_point.
6 7 8 |
# File 'lib/sp500_analyzer/crash.rb', line 6 def recovery_point @recovery_point end |
Instance Method Details
#set_recovery ⇒ Object
15 16 17 18 |
# File 'lib/sp500_analyzer/crash.rb', line 15 def set_recovery @recovery_point = AnalyzeData.find_recovery(peak) # @recovery_point = "(Market has not recovered)" if @recovery_point.nil? end |