Sha256: 52ab3acc59e4f6e5314cb146ee87d312431efcb438121b07b36d5467f9986a6e
Contents?: true
Size: 745 Bytes
Versions: 1
Compression:
Stored size: 745 Bytes
Contents
class Valvat def initialize(raw) @raw = Valvat::Utils.normalize(raw || "") @vat_country_code, @to_s_wo_country = to_a end attr_reader :raw, :vat_country_code, :to_s_wo_country def blank? raw.nil? || raw.strip == "" end def valid? Valvat::Syntax.validate(self) end def iso_country_code Valvat::Utils.vat_country_to_iso_country(vat_country_code) end def european? Valvat::Utils::EU_COUNTRIES.include?(iso_country_code) end def to_a Valvat::Utils.split(raw) end def to_s raw end def inspect "#<Valvat #{[raw, iso_country_code].compact.join(" ")}>" end end def Valvat(vat) vat.is_a?(Valvat) ? vat : Valvat.new(vat) end require 'valvat/utils' require 'valvat/syntax'
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
valvat-core-0.0.1 | lib/valvat.rb |