Class: PoliPage::ThumbnailOptions

Inherits:
Data
  • Object
show all
Defined in:
lib/poli_page/inputs/thumbnail_options.rb

Overview

Convenience value-object form of the ‘client.documents.thumbnails` options hash. Methods accept bare kwargs directly; this wrapper is for callers who want `Data.define`’s equality + frozen-by-default semantics.

  • ‘width` [Integer] thumbnail width in pixels (required)

  • ‘format` [“png”, “jpeg”, nil] output format; default “png”

  • ‘quality` [Integer, nil] JPEG quality 1-100; only valid when format is “jpeg”

  • ‘pages` [Array<Integer>, nil] 1-based page indices to render; nil means all pages

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#formatObject (readonly)

Returns the value of attribute format

Returns:

  • (Object)

    the current value of format



12
13
14
# File 'lib/poli_page/inputs/thumbnail_options.rb', line 12

def format
  @format
end

#pagesObject (readonly)

Returns the value of attribute pages

Returns:

  • (Object)

    the current value of pages



12
13
14
# File 'lib/poli_page/inputs/thumbnail_options.rb', line 12

def pages
  @pages
end

#qualityObject (readonly)

Returns the value of attribute quality

Returns:

  • (Object)

    the current value of quality



12
13
14
# File 'lib/poli_page/inputs/thumbnail_options.rb', line 12

def quality
  @quality
end

#widthObject (readonly)

Returns the value of attribute width

Returns:

  • (Object)

    the current value of width



12
13
14
# File 'lib/poli_page/inputs/thumbnail_options.rb', line 12

def width
  @width
end

Class Method Details

._strict_newObject



19
# File 'lib/poli_page/inputs/thumbnail_options.rb', line 19

alias _strict_new new

.new(width:, format: nil, quality: nil, pages: nil) ⇒ Object



21
22
23
# File 'lib/poli_page/inputs/thumbnail_options.rb', line 21

def new(width:, format: nil, quality: nil, pages: nil)
  _strict_new(width: width, format: format, quality: quality, pages: pages)
end

Instance Method Details

#to_hObject



13
14
15
# File 'lib/poli_page/inputs/thumbnail_options.rb', line 13

def to_h
  super.compact
end