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

Returns a new instance of PeriodicallyValue.



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

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

Instance Attribute Details

#endObject (readonly)

Returns the value of attribute end.



165
166
167
# File 'lib/jiji/models.rb', line 165

def end
  @end
end

#maxObject (readonly)

Returns the value of attribute max.



166
167
168
# File 'lib/jiji/models.rb', line 166

def max
  @max
end

#minObject (readonly)

Returns the value of attribute min.



167
168
169
# File 'lib/jiji/models.rb', line 167

def min
  @min
end

#startObject (readonly)

Returns the value of attribute start.



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

def start
  @start
end

Instance Method Details

#<<(value) ⇒ Object



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

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

値を配列で取得する



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

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

#values=(values) ⇒ Object

値を配列で設定する



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

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