Class: JIJI::Rate

Inherits:
Object
  • Object
show all
Includes:
Dao::TimedData, Util::Model
Defined in:
lib/jiji/models.rb

Overview

レート

Instance Attribute Summary collapse

Attributes included from Dao::TimedData

#time

Instance Method Summary collapse

Methods included from Util::Model

#==, #===, #eql?, #hash

Constructor Details

#initialize(bid = nil, ask = nil, sell_swap = nil, buy_swap = nil, time = nil) ⇒ Rate



37
38
39
40
41
42
43
# File 'lib/jiji/models.rb', line 37

def initialize( bid=nil, ask=nil, sell_swap=nil, buy_swap=nil, time=nil )
  @bid = bid
  @ask = ask
  @sell_swap = sell_swap
  @buy_swap = buy_swap
  @time = time
end

Instance Attribute Details

#askObject (readonly)

Returns the value of attribute ask.



55
56
57
# File 'lib/jiji/models.rb', line 55

def ask
  @ask
end

#bidObject (readonly)

Returns the value of attribute bid.



55
56
57
# File 'lib/jiji/models.rb', line 55

def bid
  @bid
end

#buy_swapObject (readonly)

Returns the value of attribute buy_swap.



55
56
57
# File 'lib/jiji/models.rb', line 55

def buy_swap
  @buy_swap
end

#sell_swapObject (readonly)

Returns the value of attribute sell_swap.



55
56
57
# File 'lib/jiji/models.rb', line 55

def sell_swap
  @sell_swap
end

Instance Method Details

#valuesObject

値を配列で取得する



45
46
47
# File 'lib/jiji/models.rb', line 45

def values
  [bid,ask,sell_swap,buy_swap,time.to_i]
end

#values=(values) ⇒ Object

値を配列で設定する



49
50
51
52
53
54
# File 'lib/jiji/models.rb', line 49

def values=(values)
  @bid = values[0].to_f
  @ask = values[1].to_f
  @sell_swap = values[2].to_f
  @buy_swap  = values[3].to_f
end