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

:nodoc:



44
45
46
47
48
49
50
# File 'lib/jiji/models.rb', line 44

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

Instance Attribute Details

#askObject (readonly)

askレート



65
66
67
# File 'lib/jiji/models.rb', line 65

def ask
  @ask
end

#bidObject (readonly)

bidレート



63
64
65
# File 'lib/jiji/models.rb', line 63

def bid
  @bid
end

#buy_swapObject (readonly)

買いスワップ



69
70
71
# File 'lib/jiji/models.rb', line 69

def buy_swap
  @buy_swap
end

#sell_swapObject (readonly)

売りスワップ



67
68
69
# File 'lib/jiji/models.rb', line 67

def sell_swap
  @sell_swap
end

Instance Method Details

#valuesObject

値を配列で取得する



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

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

#values=(values) ⇒ Object

値を配列で設定する



56
57
58
59
60
61
# File 'lib/jiji/models.rb', line 56

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