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
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
#end ⇒ Object (readonly)
Returns the value of attribute end.
165 166 167 |
# File 'lib/jiji/models.rb', line 165 def end @end end |
#max ⇒ Object (readonly)
Returns the value of attribute max.
166 167 168 |
# File 'lib/jiji/models.rb', line 166 def max @max end |
#min ⇒ Object (readonly)
Returns the value of attribute min.
167 168 169 |
# File 'lib/jiji/models.rb', line 167 def min @min end |
#start ⇒ Object (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 |
#values ⇒ Object
値を配列で取得する
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 |