Class: MoneyExchange::Money
- Inherits:
-
Object
- Object
- MoneyExchange::Money
- Defined in:
- lib/money_exchange.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
Instance Method Summary collapse
-
#initialize(amount, currency) ⇒ Money
constructor
A new instance of Money.
- #method_missing(meth, *a, &b) ⇒ Object
Constructor Details
#initialize(amount, currency) ⇒ Money
Returns a new instance of Money.
25 26 27 28 |
# File 'lib/money_exchange.rb', line 25 def initialize(amount, currency) @amount = Float(amount) @currency = currency end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
24 25 26 |
# File 'lib/money_exchange.rb', line 24 def amount @amount end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
24 25 26 |
# File 'lib/money_exchange.rb', line 24 def currency @currency end |