Class: ExchangeRatesGenerator::Formatters::Base
- Inherits:
-
Object
- Object
- ExchangeRatesGenerator::Formatters::Base
- Defined in:
- lib/exchange-rates-generator/formatters/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#rates ⇒ Object
readonly
Returns the value of attribute rates.
Class Method Summary collapse
-
.formatters ⇒ Array
Returns all Formatters.
-
.inherited(formatter) ⇒ Object
Records all new Formatters.
Instance Method Summary collapse
-
#initialize(currency, rates) ⇒ Base
constructor
A new instance of Base.
- #to_s ⇒ Object
Constructor Details
#initialize(currency, rates) ⇒ Base
Returns a new instance of Base.
14 15 16 17 |
# File 'lib/exchange-rates-generator/formatters/base.rb', line 14 def initialize(currency, rates) @currency = currency.to_s.upcase.to_sym @rates = rates end |
Instance Attribute Details
#currency ⇒ Object (readonly)
Returns the value of attribute currency.
12 13 14 |
# File 'lib/exchange-rates-generator/formatters/base.rb', line 12 def currency @currency end |
#rates ⇒ Object (readonly)
Returns the value of attribute rates.
12 13 14 |
# File 'lib/exchange-rates-generator/formatters/base.rb', line 12 def rates @rates end |
Class Method Details
.formatters ⇒ Array
Returns all Formatters
29 30 31 |
# File 'lib/exchange-rates-generator/formatters/base.rb', line 29 def formatters @formatters ||= [] end |
.inherited(formatter) ⇒ Object
Records all new Formatters
34 35 36 |
# File 'lib/exchange-rates-generator/formatters/base.rb', line 34 def inherited(formatter) self.formatters << formatter end |
Instance Method Details
#to_s ⇒ Object
19 20 21 |
# File 'lib/exchange-rates-generator/formatters/base.rb', line 19 def to_s header + body + end |