Class: PisPasep::Base
- Inherits:
-
Object
- Object
- PisPasep::Base
- Defined in:
- lib/pis_pasep/pis_pasep.rb
Instance Attribute Summary collapse
-
#number ⇒ Object
readonly
Returns the value of attribute number.
Instance Method Summary collapse
- #==(outro) ⇒ Object
-
#initialize(number) ⇒ Base
constructor
A new instance of Base.
- #to_s ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(number) ⇒ Base
Returns a new instance of Base.
5 6 7 8 |
# File 'lib/pis_pasep/pis_pasep.rb', line 5 def initialize(number) @number = number @number = @number =~ PIS_PASEP_REGEX ? format_number! : @number end |
Instance Attribute Details
#number ⇒ Object (readonly)
Returns the value of attribute number.
3 4 5 |
# File 'lib/pis_pasep/pis_pasep.rb', line 3 def number @number end |
Instance Method Details
#==(outro) ⇒ Object
20 21 22 |
# File 'lib/pis_pasep/pis_pasep.rb', line 20 def ==(outro) self.number == outro.number end |
#to_s ⇒ Object
16 17 18 |
# File 'lib/pis_pasep/pis_pasep.rb', line 16 def to_s number end |
#valid? ⇒ Boolean
10 11 12 13 14 |
# File 'lib/pis_pasep/pis_pasep.rb', line 10 def valid? return true if @number.nil? return false unless format_valid? number_valid? end |