Class: JIJI::PeriodicallyRates

Inherits:
Hash
  • Object
show all
Includes:
Util::Model
Defined in:
lib/jiji/models.rb

Overview

一定期間のレートの集合

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Util::Model

#==, #===, #eql?, #hash

Constructor Details

#initialize(pair_infos, list = []) ⇒ PeriodicallyRates

Returns a new instance of PeriodicallyRates.



59
60
61
62
63
64
65
# File 'lib/jiji/models.rb', line 59

def initialize( pair_infos, list=[] )
  super()
  @pair_infos = pair_infos
  list.each {|rates|
    self << rates
  }
end

Instance Attribute Details

#end_timeObject

Returns the value of attribute end_time.



80
81
82
# File 'lib/jiji/models.rb', line 80

def end_time
  @end_time
end

#pair_infosObject (readonly)

Returns the value of attribute pair_infos.



78
79
80
# File 'lib/jiji/models.rb', line 78

def pair_infos
  @pair_infos
end

#start_timeObject

Returns the value of attribute start_time.



79
80
81
# File 'lib/jiji/models.rb', line 79

def start_time
  @start_time
end

Instance Method Details

#<<(rates) ⇒ Object



66
67
68
69
70
71
72
73
74
# File 'lib/jiji/models.rb', line 66

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

#timeObject



75
76
77
# File 'lib/jiji/models.rb', line 75

def time
  @start_time
end