Class: Wowr::Classes::Money

Inherits:
Object
  • Object
show all
Defined in:
lib/wowr/general.rb

Overview

TODO: Fix default to_s option

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(total) ⇒ Money

Returns a new instance of Money.



13
14
15
# File 'lib/wowr/general.rb', line 13

def initialize(total)
	@total = total
end

Instance Attribute Details

#totalObject (readonly) Also known as: to_i, to_s

Returns the value of attribute total.



9
10
11
# File 'lib/wowr/general.rb', line 9

def total
  @total
end

Instance Method Details

#+(add) ⇒ Object



29
30
31
# File 'lib/wowr/general.rb', line 29

def +(add)
	return Money.new(self.total + add.total)
end

#-(add) ⇒ Object



33
34
35
# File 'lib/wowr/general.rb', line 33

def -(add)
	return Money.new(self.total - add.total)
end

#bronzeObject



25
26
27
# File 'lib/wowr/general.rb', line 25

def bronze
	return @total % 100
end

#goldObject



17
18
19
# File 'lib/wowr/general.rb', line 17

def gold
	return (@total / 10000)
end

#silverObject



21
22
23
# File 'lib/wowr/general.rb', line 21

def silver
	return (@total % 10000) / 100
end