Class: Heisencoin::Exchange

Inherits:
Object
  • Object
show all
Defined in:
lib/heisencoin/exchange.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(simple = nil) ⇒ Exchange

Returns a new instance of Exchange.


7
8
9
# File 'lib/heisencoin/exchange.rb', line 7

def initialize(simple = nil)
  from_simple(simple) if simple
end

Instance Attribute Details

#feeObject

Returns the value of attribute fee.


5
6
7
# File 'lib/heisencoin/exchange.rb', line 5

def fee
  @fee
end

#nameObject

Returns the value of attribute name.


5
6
7
# File 'lib/heisencoin/exchange.rb', line 5

def name
  @name
end

#timeObject

Returns the value of attribute time.


5
6
7
# File 'lib/heisencoin/exchange.rb', line 5

def time
  @time
end

Instance Method Details

#==(other) ⇒ Object


21
22
23
# File 'lib/heisencoin/exchange.rb', line 21

def ==(other)
  self.name == other.name
end

#from_simple(simple) ⇒ Object


11
12
13
14
# File 'lib/heisencoin/exchange.rb', line 11

def from_simple(simple)
  @name = simple['name']
  @fee = simple['fee']
end

#to_simpleObject


16
17
18
19
# File 'lib/heisencoin/exchange.rb', line 16

def to_simple
  {'name' => name,
   'fee' => fee}
end