Class: Puppeteer::Page::PDFOptions::Margin

Inherits:
Object
  • Object
show all
Defined in:
lib/puppeteer/page/pdf_options.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Margin

Returns a new instance of Margin.



107
108
109
110
111
112
# File 'lib/puppeteer/page/pdf_options.rb', line 107

def initialize(options)
  @top = options[:top]
  @bottom = options[:bottom]
  @left = options[:left]
  @right = options[:right]
end

Instance Attribute Details

#bottomObject (readonly)

Returns the value of attribute bottom.



123
124
125
# File 'lib/puppeteer/page/pdf_options.rb', line 123

def bottom
  @bottom
end

#leftObject (readonly)

Returns the value of attribute left.



123
124
125
# File 'lib/puppeteer/page/pdf_options.rb', line 123

def left
  @left
end

#rightObject (readonly)

Returns the value of attribute right.



123
124
125
# File 'lib/puppeteer/page/pdf_options.rb', line 123

def right
  @right
end

#topObject (readonly)

Returns the value of attribute top.



123
124
125
# File 'lib/puppeteer/page/pdf_options.rb', line 123

def top
  @top
end

Instance Method Details

#translate(&block) ⇒ Object



114
115
116
117
118
119
120
121
122
# File 'lib/puppeteer/page/pdf_options.rb', line 114

def translate(&block)
  new_margin ={
    top: block.call(@top),
    bottom: block.call(@bottom),
    left: block.call(@left),
    right: block.call(@right),
  }
  Margin.new(new_margin)
end