Sha256: fec267ed1b00adc4a742df3a1aa647afbdb25b4478abd639061a6300776688af
Contents?: true
Size: 875 Bytes
Versions: 6
Compression:
Stored size: 875 Bytes
Contents
class Valvat def initialize(raw) @raw = raw || "" @vat_country_code, @to_s_wo_country = to_a end attr_reader :raw, :vat_country_code, :to_s_wo_country def valid? Valvat::Syntax.validate(self) end def exists? Valvat::Lookup.validate(self) end alias_method :exist?, :exists? 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' require 'valvat/lookup' require 'valvat/version' require 'valvat/active_model' if defined?(ActiveModel)
Version data entries
6 entries across 6 versions & 1 rubygems
Version | Path |
---|---|
valvat-0.3.3 | lib/valvat.rb |
valvat-0.3.2 | lib/valvat.rb |
valvat-0.3.1 | lib/valvat.rb |
valvat-0.3.0 | lib/valvat.rb |
valvat-0.2.3 | lib/valvat.rb |
valvat-0.2.2 | lib/valvat.rb |