lib/itax_code.rb in itax_code-0.4.1 vs lib/itax_code.rb in itax_code-1.0.0
- old
+ new
@@ -7,10 +7,12 @@
require "itax_code/encoder"
require "itax_code/parser"
require "itax_code/validator"
module ItaxCode
+ Error = Class.new(StandardError)
+
class << self
# Encodes user tax code.
#
# @param [Hash] data The user attributes
#
@@ -36,21 +38,19 @@
# Checks the given tax code validity against new one
# encoded from user informations.
#
# @param [String] tax_code The user tax code
- # @param [Hash] data The user attributes
+ # @param [Hash] data The optional user attributes
#
# @option data [String] :surname
# @option data [String] :name
# @option data [String] :gender
# @option data [String, Date] :birthdate
# @option data [String] :birthplace
#
# @return [Boolean]
- def valid?(tax_code, data)
- Validator.new(data).valid?(tax_code)
+ def valid?(tax_code, data = {})
+ Validator.new(tax_code, data).valid?
end
end
-
- class Error < StandardError; end
end