Class: MagickNumbers::Regon

Inherits:
Object
  • Object
show all
Defined in:
lib/magick_numbers/regon.rb

Instance Method Summary collapse

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

Returns:

  • (Boolean)


16
17
18
19
# File 'lib/magick_numbers/regon.rb', line 16

def valid?
  return @factory.valid? if @factory
  false
end