Method: MuPDF::Box.parse

Defined in:
lib/mupdf/box.rb

.parse(text, kind:) ⇒ MuPDF::Box?

Parameters:

  • text (String)
  • kind (Symbol)

Returns:



32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/mupdf/box.rb', line 32

def self.parse(text, kind:)
  match = text.match(REGEX)
  return unless match

  new(
    l: BigDecimal(match[:l]),
    b: BigDecimal(match[:b]),
    r: BigDecimal(match[:r]),
    t: BigDecimal(match[:t]),
    kind:
  )
end