Sha256: 0cc2b38890b2851b859dbcccabd7bad2adeeccf5e9cc2a52d205511fb4f69d6f

Contents?: true

Size: 562 Bytes

Versions: 2

Compression:

Stored size: 562 Bytes

Contents

PUBLISHERS = YAML.load_file(File.join(File.dirname(__FILE__),
                                      "../../publishers.yaml"))

module NistPubid
  class Publisher
    attr_accessor :publisher

    def initialize(publisher:)
      @publisher = publisher
    end

    def to_s(format = :short)
      return @publisher if %i[short mr].include?(format)

      PUBLISHERS[format.to_s][@publisher]
    end

    def self.publishers_keys
      PUBLISHERS["long"].keys
    end

    def self.regexp
      /(#{PUBLISHERS["long"].keys.join('|')})(?=\.|\s)/
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nist-pubid-0.1.7 lib/nist_pubid/publisher.rb
nist-pubid-0.1.6 lib/nist_pubid/publisher.rb