Class: MuPDF::Info

Inherits:
Object
  • Object
show all
Defined in:
lib/mupdf/info.rb

Overview

A wrapper for the result of a ‘mutool info …` command.

Constant Summary collapse

PARSE_REGEX =
/^Pages: (?<pages>\d+)$/

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pages:) ⇒ Info

Returns a new instance of Info.

Parameters:

  • pages (Integer)


21
22
23
# File 'lib/mupdf/info.rb', line 21

def initialize(pages:)
  @pages = pages
end

Instance Attribute Details

#descriptionString

Returns The description of the task.

Returns:

  • (String)

    The description of the task.



10
# File 'lib/mupdf/info.rb', line 10

attr_reader :pages

#pagesObject (readonly)

Returns the value of attribute pages.



10
11
12
# File 'lib/mupdf/info.rb', line 10

def pages
  @pages
end

Class Method Details

.parse(text) ⇒ MuPDF::Info

Parameters:

  • text (String)

Returns:



15
16
17
18
# File 'lib/mupdf/info.rb', line 15

def self.parse(text)
  match = text.match(PARSE_REGEX)
  new(pages: Integer(match[:pages]))
end