Sha256: 11aa219fb80dc31a51b3f12cbcbd77af543e4c8da51f07af8e33bddda9d6f50c

Contents?: true

Size: 593 Bytes

Versions: 51

Compression:

Stored size: 593 Bytes

Contents

class Puppeteer::ElementHandle < Puppeteer::JSHandle
  class BoxModel
    QUAD_ATTRIBUTE_NAMES = %i(content padding border margin)
    # @param result [Hash]
    def initialize(result_model)
      QUAD_ATTRIBUTE_NAMES.each do |attr_name|
        quad = result_model[attr_name.to_s]
        instance_variable_set(
          :"@#{attr_name}",
          quad.each_slice(2).map { |x, y| Point.new(x: x, y: y) },
        )
      end
      @width = result_model['width']
      @height = result_model['height']
    end
    attr_reader(*QUAD_ATTRIBUTE_NAMES)
    attr_reader :width, :height
  end
end

Version data entries

51 entries across 51 versions & 1 rubygems

Version Path
puppeteer-ruby-0.40.4 lib/puppeteer/element_handle/box_model.rb
puppeteer-ruby-0.40.3 lib/puppeteer/element_handle/box_model.rb
puppeteer-ruby-0.40.2 lib/puppeteer/element_handle/box_model.rb
puppeteer-ruby-0.40.1 lib/puppeteer/element_handle/box_model.rb
puppeteer-ruby-0.40.0 lib/puppeteer/element_handle/box_model.rb
puppeteer-ruby-0.39.0 lib/puppeteer/element_handle/box_model.rb
puppeteer-ruby-0.38.0 lib/puppeteer/element_handle/box_model.rb
puppeteer-ruby-0.37.4 lib/puppeteer/element_handle/box_model.rb
puppeteer-ruby-0.37.3 lib/puppeteer/element_handle/box_model.rb
puppeteer-ruby-0.37.2 lib/puppeteer/element_handle/box_model.rb
puppeteer-ruby-0.37.1 lib/puppeteer/element_handle/box_model.rb
puppeteer-ruby-0.37.0 lib/puppeteer/element_handle/box_model.rb
puppeteer-ruby-0.36.0 lib/puppeteer/element_handle/box_model.rb
puppeteer-ruby-0.35.1 lib/puppeteer/element_handle/box_model.rb
puppeteer-ruby-0.35.0 lib/puppeteer/element_handle/box_model.rb
puppeteer-ruby-0.34.3 lib/puppeteer/element_handle/box_model.rb
puppeteer-ruby-0.34.2 lib/puppeteer/element_handle/box_model.rb
puppeteer-ruby-0.34.1 lib/puppeteer/element_handle/box_model.rb
puppeteer-ruby-0.34.0 lib/puppeteer/element_handle/box_model.rb
puppeteer-ruby-0.33.0 lib/puppeteer/element_handle/box_model.rb