Class: JIJI::PeriodicallyRates
- Inherits:
-
Hash
- Object
- Hash
- JIJI::PeriodicallyRates
- Includes:
- Util::Model
- Defined in:
- lib/jiji/models.rb
Overview
一定期間のレートの集合
Instance Attribute Summary collapse
-
#end_time ⇒ Object
Returns the value of attribute end_time.
-
#pair_infos ⇒ Object
readonly
Returns the value of attribute pair_infos.
-
#start_time ⇒ Object
Returns the value of attribute start_time.
Instance Method Summary collapse
- #<<(rates) ⇒ Object
-
#initialize(pair_infos, list = []) ⇒ PeriodicallyRates
constructor
A new instance of PeriodicallyRates.
- #time ⇒ Object
Methods included from Util::Model
Constructor Details
#initialize(pair_infos, list = []) ⇒ PeriodicallyRates
Returns a new instance of PeriodicallyRates.
63 64 65 66 67 68 69 |
# File 'lib/jiji/models.rb', line 63 def initialize( pair_infos, list=[] ) super() @pair_infos = pair_infos list.each {|rates| self << rates } end |
Instance Attribute Details
#end_time ⇒ Object
Returns the value of attribute end_time.
84 85 86 |
# File 'lib/jiji/models.rb', line 84 def end_time @end_time end |
#pair_infos ⇒ Object (readonly)
Returns the value of attribute pair_infos.
82 83 84 |
# File 'lib/jiji/models.rb', line 82 def pair_infos @pair_infos end |
#start_time ⇒ Object
Returns the value of attribute start_time.
83 84 85 |
# File 'lib/jiji/models.rb', line 83 def start_time @start_time end |
Instance Method Details
#<<(rates) ⇒ Object
70 71 72 73 74 75 76 77 78 |
# File 'lib/jiji/models.rb', line 70 def <<(rates) now = rates.time @start_time = now unless @start_time @end_time = now rates.each_pair { |code,rate| self[code] = PeriodicallyRate.new unless key? code self[code] << rate } end |
#time ⇒ Object
79 80 81 |
# File 'lib/jiji/models.rb', line 79 def time @start_time end |