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.



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

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.



133
134
135
# File 'lib/puppeteer/page/pdf_options.rb', line 133

def bottom
  @bottom
end

#leftObject (readonly)

Returns the value of attribute left.



133
134
135
# File 'lib/puppeteer/page/pdf_options.rb', line 133

def left
  @left
end

#rightObject (readonly)

Returns the value of attribute right.



133
134
135
# File 'lib/puppeteer/page/pdf_options.rb', line 133

def right
  @right
end

#topObject (readonly)

Returns the value of attribute top.



133
134
135
# File 'lib/puppeteer/page/pdf_options.rb', line 133

def top
  @top
end

Instance Method Details

#translate(&block) ⇒ Object



124
125
126
127
128
129
130
131
132
# File 'lib/puppeteer/page/pdf_options.rb', line 124

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