Sha256: ae92bcc432f175eb3fc2512f0942f5727db9234bb2cf4ec3359b5762c2b05d18

Contents?: true

Size: 1015 Bytes

Versions: 4

Compression:

Stored size: 1015 Bytes

Contents

module Patentscope

  class PctAppNumber < String

    def initialize(number = "")
      raise NoNumberError,
        "Patent application number was not entered" if number.nil?
      super(number.strip)
    end

    def valid?
      self.match(/\A(([Pp][Cc][Tt]\/?)?[a-zA-Z]{2}\d{4}\/?\d{6})\Z/)
    end

    def validate
      raise WrongNumberFormatError,
        "PCT application number is not in correct format (PCT/CCYYYY/NNNNNN)" unless valid?
    end

    def to_ia_number
      self.upcase!
      self.gsub!('/', '')
      self.gsub!('PCT', '')
      self
    end
  end

  class PctPubNumber < String

    def initialize(number = "")
      raise NoNumberError,
        "Patent publication number was not entered" if number.nil?
      super(number.strip)
    end

    def valid?
      self.match(/\A(([Ww][Oo]\/?)?\s?\d{4}\/?\s?\d{6})\Z/)
    end

    def validate
      raise WrongNumberFormatError,
        "PCT publication number is not in correct format (WO/YYYY/NNNNNN)" unless valid?
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
patentscope-0.0.5 lib/patentscope/pct_doc_number.rb
patentscope-0.0.4 lib/patentscope/pct_doc_number.rb
patentscope-0.0.2 lib/patentscope/pct_doc_number.rb
patentscope-0.0.1 lib/patentscope/pct_doc_number.rb