Class: JIJI::PeriodicallyValue

Inherits:
Object
  • 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(list = []) ⇒ PeriodicallyValue



138
139
140
141
142
# File 'lib/jiji/models.rb', line 138

def initialize( list=[] )
  list.each { |item|
    self << item
  }
end

Instance Attribute Details

#endObject (readonly)

Returns the value of attribute end.



161
162
163
# File 'lib/jiji/models.rb', line 161

def end
  @end
end

#maxObject (readonly)

Returns the value of attribute max.



162
163
164
# File 'lib/jiji/models.rb', line 162

def max
  @max
end

#minObject (readonly)

Returns the value of attribute min.



163
164
165
# File 'lib/jiji/models.rb', line 163

def min
  @min
end

#startObject (readonly)

Returns the value of attribute start.



160
161
162
# File 'lib/jiji/models.rb', line 160

def start
  @start
end

Instance Method Details

#<<(value) ⇒ Object



143
144
145
146
147
148
# File 'lib/jiji/models.rb', line 143

def <<( value )
  @start = value if @start == nil
  @end = value
  @max = value if @max == nil || value > @max
  @min = value if @min == nil || value < @min
end

#valuesObject

値を配列で取得する



150
151
152
# File 'lib/jiji/models.rb', line 150

def values
  [@start, @end, @max, @min]
end

#values=(values) ⇒ Object

値を配列で設定する



154
155
156
157
158
159
# File 'lib/jiji/models.rb', line 154

def values=(values)
  @start = values[0].to_f
  @end   = values[1].to_f
  @max   = values[2].to_f
  @min   = values[3].to_f
end