Class: Monerorequest::Validator::Amount
- Inherits:
-
Object
- Object
- Monerorequest::Validator::Amount
- Defined in:
- lib/monerorequest/validator/amount.rb
Overview
validates the amount field
Class Method Summary collapse
Class Method Details
.validate!(data) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/monerorequest/validator/amount.rb', line 7 def self.validate!(data) errors = [] errors.push("amount must be present.") unless data.key?("amount") errors.push("amount must be a Numeric.") unless data["amount"].is_a?(Numeric) errors.push("amount must be positive.") unless data["amount"].to_f.positive? errors end |