Sha256: 749843d64d702e4953bf8a4338a13a42cf2c35d9301322745b819b31837876b9

Contents?: true

Size: 539 Bytes

Versions: 7

Compression:

Stored size: 539 Bytes

Contents

# frozen_string_literal: true

module MuPDF
  # A wrapper for the result of a `mutool info ...` command.
  class Info
    PARSE_REGEX = /^Pages: (?<pages>\d+)$/

    # @!attribute description
    #   @return [String] The description of the task.
    attr_reader :pages

    # @param text [String]
    #
    # @return [MuPDF::Info]
    def self.parse(text)
      match = text.match(PARSE_REGEX)
      new(pages: Integer(match[:pages]))
    end

    # @param pages [Integer]
    def initialize(pages:)
      @pages = pages
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
mupdf-1.0.4 lib/mupdf/info.rb
mupdf-1.0.3 lib/mupdf/info.rb
mupdf-1.0.2 lib/mupdf/info.rb
mupdf-1.0.1 lib/mupdf/info.rb
mupdf-1.0.0 lib/mupdf/info.rb
mupdf-0.4.0 lib/mupdf/info.rb
mupdf-0.3.0 lib/mupdf/info.rb