Class: Cellularity::Iccid
- Inherits:
-
Object
- Object
- Cellularity::Iccid
- Defined in:
- lib/cellularity/iccid.rb
Instance Attribute Summary collapse
-
#iccid ⇒ Object
Returns the value of attribute iccid.
Instance Method Summary collapse
-
#initialize(iccid = '') ⇒ Iccid
constructor
A new instance of Iccid.
- #valid? ⇒ Boolean
Constructor Details
#initialize(iccid = '') ⇒ Iccid
Returns a new instance of Iccid.
5 6 7 |
# File 'lib/cellularity/iccid.rb', line 5 def initialize(iccid = '') self.iccid = iccid.to_s end |
Instance Attribute Details
#iccid ⇒ Object
Returns the value of attribute iccid.
3 4 5 |
# File 'lib/cellularity/iccid.rb', line 3 def iccid @iccid end |
Instance Method Details
#valid? ⇒ Boolean
9 10 11 12 13 |
# File 'lib/cellularity/iccid.rb', line 9 def valid? [19, 20].include?(self.iccid.length) && !!Integer(self.iccid) rescue ArgumentError, TypeError false end |