Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/kennitala_string.rb
Overview
Monkey patch for the String class
Instance Method Summary collapse
-
#kt? ⇒ Boolean
(also: #kennitala?)
Checks if the String is valid for initializing a Kennitala object.
-
#to_kt ⇒ Kennitala
(also: #to_kennitala)
Converts a String to a Kennitala object.
Instance Method Details
#kt? ⇒ Boolean Also known as: kennitala?
Checks if the String is valid for initializing a Kennitala object
This is useful if you want to deal with conditionals before catching errors.
17 18 19 20 21 |
# File 'lib/kennitala_string.rb', line 17 def kt? true if Kennitala.new(self) rescue ArgumentError, TypeError false end |