Module: Einvoice::Neweb::Validator
- Included in:
- Model::Base, AmountValidator, QuantityValidator, UnitPriceValidator
- Defined in:
- lib/einvoice/neweb/validator/invoice_validator.rb,
lib/einvoice/neweb/validator/invoice_item_validator.rb
Defined Under Namespace
Classes: AmountValidator, BuyerNameValidator, CarrierId1Validator, CarrierId2Validator, DonateMarkValidator, PrintMarkValidator, QuantityValidator, TotalAmountValidator, UnitPriceValidator
Instance Method Summary collapse
Instance Method Details
#valid_float?(value) ⇒ Boolean
34 35 36 37 38 39 40 |
# File 'lib/einvoice/neweb/validator/invoice_item_validator.rb', line 34 def valid_float?(value) integer, digit = value.to_s.split(".")[0..1] float_value = value.to_f.to_s return false if integer.nil? || digit.nil? || integer.delete("-").size > 12 || digit.try(:size) > 4 return false if integer != float_value.split(".")[0] || digit != float_value.split(".")[1] end |