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.



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_timeObject

Returns the value of attribute end_time.



84
85
86
# File 'lib/jiji/models.rb', line 84

def end_time
  @end_time
end

#pair_infosObject (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_timeObject

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

#timeObject



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

def time
  @start_time
end