Class: MagickNumbers::Regon
- Inherits:
-
Object
- Object
- MagickNumbers::Regon
- Defined in:
- lib/magick_numbers/regon.rb
Instance Method Summary collapse
-
#initialize(num) ⇒ Regon
constructor
A new instance of Regon.
- #valid? ⇒ Boolean
Constructor Details
#initialize(num) ⇒ Regon
Returns a new instance of Regon.
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/magick_numbers/regon.rb', line 5 def initialize(num) @factory = if(/^\d{9}$/ =~ num) Regon9.new num elsif(/^\d{14}$/ =~ num) Regon14.new num else nil end end |
Instance Method Details
#valid? ⇒ Boolean
16 17 18 19 |
# File 'lib/magick_numbers/regon.rb', line 16 def valid? return @factory.valid? if @factory false end |