Class: Geckoboard::MoneyField
- Inherits:
-
OptionalField
- Object
- Field
- OptionalField
- Geckoboard::MoneyField
- Defined in:
- lib/geckoboard/field_types.rb
Instance Attribute Summary collapse
-
#currency_code ⇒ Object
readonly
Returns the value of attribute currency_code.
Attributes inherited from OptionalField
Attributes inherited from Field
Instance Method Summary collapse
-
#initialize(id, currency_code: nil, **options) ⇒ MoneyField
constructor
A new instance of MoneyField.
- #to_hash ⇒ Object
Constructor Details
#initialize(id, currency_code: nil, **options) ⇒ MoneyField
Returns a new instance of MoneyField.
58 59 60 61 62 63 |
# File 'lib/geckoboard/field_types.rb', line 58 def initialize(id, currency_code: nil, **) raise ArgumentError, "`currency_code:' is a required argument" if currency_code.nil? super(id, **) @currency_code = currency_code end |
Instance Attribute Details
#currency_code ⇒ Object (readonly)
Returns the value of attribute currency_code.
56 57 58 |
# File 'lib/geckoboard/field_types.rb', line 56 def currency_code @currency_code end |
Instance Method Details
#to_hash ⇒ Object
65 66 67 |
# File 'lib/geckoboard/field_types.rb', line 65 def to_hash super.merge(type: :money, currency_code: currency_code) end |