Class: Wowr::Classes::Money
- Inherits:
-
Object
- Object
- Wowr::Classes::Money
- Defined in:
- lib/wowr/general.rb
Overview
TODO: Fix default to_s option
Instance Attribute Summary collapse
-
#total ⇒ Object
(also: #to_i, #to_s)
readonly
Returns the value of attribute total.
Instance Method Summary collapse
- #bronze ⇒ Object
- #gold ⇒ Object
-
#initialize(total) ⇒ Money
constructor
A new instance of Money.
- #silver ⇒ Object
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
#total ⇒ Object (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
#bronze ⇒ Object
25 26 27 |
# File 'lib/wowr/general.rb', line 25 def bronze return @total % 100 end |
#gold ⇒ Object
17 18 19 |
# File 'lib/wowr/general.rb', line 17 def gold return (@total / 10000) end |
#silver ⇒ Object
21 22 23 |
# File 'lib/wowr/general.rb', line 21 def silver return (@total % 10000) / 100 end |