Class: JIJI::PeriodicallyValue
- Inherits:
-
Object
- Object
- JIJI::PeriodicallyValue
- Includes:
- Util::Model
- Defined in:
- lib/jiji/models.rb
Overview
一定期間の値
始値、終値、高値、安値の四本値
Instance Attribute Summary collapse
-
#end ⇒ Object
readonly
Returns the value of attribute end.
-
#max ⇒ Object
readonly
Returns the value of attribute max.
-
#min ⇒ Object
readonly
Returns the value of attribute min.
-
#start ⇒ Object
readonly
Returns the value of attribute start.
Instance Method Summary collapse
- #<<(value) ⇒ Object
-
#initialize(list = []) ⇒ PeriodicallyValue
constructor
A new instance of PeriodicallyValue.
-
#values ⇒ Object
値を配列で取得する.
-
#values=(values) ⇒ Object
値を配列で設定する.
Methods included from Util::Model
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
#end ⇒ Object (readonly)
Returns the value of attribute end.
161 162 163 |
# File 'lib/jiji/models.rb', line 161 def end @end end |
#max ⇒ Object (readonly)
Returns the value of attribute max.
162 163 164 |
# File 'lib/jiji/models.rb', line 162 def max @max end |
#min ⇒ Object (readonly)
Returns the value of attribute min.
163 164 165 |
# File 'lib/jiji/models.rb', line 163 def min @min end |
#start ⇒ Object (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 |
#values ⇒ Object
値を配列で取得する
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 |