Class: Patentscope::PctPubNumber
- Inherits:
-
String
- Object
- String
- Patentscope::PctPubNumber
- Defined in:
- lib/patentscope/pct_doc_number.rb
Instance Method Summary collapse
-
#initialize(number = "") ⇒ PctPubNumber
constructor
A new instance of PctPubNumber.
- #valid? ⇒ Boolean
- #validate ⇒ Object
Constructor Details
#initialize(number = "") ⇒ PctPubNumber
Returns a new instance of PctPubNumber.
30 31 32 33 34 |
# File 'lib/patentscope/pct_doc_number.rb', line 30 def initialize(number = "") raise NoNumberError, "Patent publication number was not entered" if number.nil? super(number.strip) end |
Instance Method Details
#valid? ⇒ Boolean
36 37 38 |
# File 'lib/patentscope/pct_doc_number.rb', line 36 def valid? self.match(/\A(([Ww][Oo]\/?)?\s?\d{4}\/?\s?\d{6})\Z/) end |
#validate ⇒ Object
40 41 42 43 |
# File 'lib/patentscope/pct_doc_number.rb', line 40 def validate raise WrongNumberFormatError, "PCT publication number is not in correct format (WO/YYYY/NNNNNN)" unless valid? end |