Module: PagSeguro::ConvertFieldToDigit
- Included in:
- Item, Payment, PreApproval
- Defined in:
- lib/pag_seguro/convert_field_to_digit.rb
Instance Method Summary collapse
Instance Method Details
#attr_reader_as_digit(*fields) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/pag_seguro/convert_field_to_digit.rb', line 3 def attr_reader_as_digit(*fields) fields.each do |field| define_method(field) do begin "%.2f" % instance_variable_get("@#{field}") rescue ArgumentError, TypeError instance_variable_get("@#{field}") end end end end |